Could Someone tell me why this python code will not work?
print ("welcome to the slope calculation shell")
print ("Please input y1 coordinate")
y1 = int(input("y1: "))
print ("Please input the y2 coordinate")
y2 = int(input("y2: "))
print ("Please input the x1 coordinate")
x1 = int(input("x1: "))
print ("Please input the x2 coordinate")
x2 = int(input("x2: "))
print (slope"is the slope of the equation")
I put that down in notepad++ with no errors apparent but when i ran it in the python interpreter it would not work. Could someone tell me whats wrong and maybe put the right version of the code in their reply? Thanks
- LocoluisLv 78 years agoFavorite Answer
Replace the last line for
print slope, " is the slope of the equation"
Also, you need to handle the case when x2 = x1
And replace all your int() by float(), or else you'll have integer-only operations.
- obscuritas88Lv 48 years ago
If you're using Python 3 or later then the last line should read:
print(slope,"is the slope of the equation")
If you're using something earlier than Python 3 then it should be:
print slope, "is the slope of the equation"
Also note that Python 3 uses input for all input, whereas Python 2 and earlier differentiates between input (integers only) and raw_input (strings). But as the poster above me said, replace 'int' with 'float' unless you intend for the coordinates to only be integers.
- hattiLv 44 years ago
I created a phython executable for abode windows with a code obtainable for my reliance broadband login. there's a application that helps to transform .py code to exe. The executable works such that as quickly as I click it the internet web site logs in and my information superhighway connection starts, inspite of the undeniable fact that it opens and closes a command abode windows as quickly through fact the script ends.
- 8 years ago
python is F**KING GAY. F**K PYTHON