sum = input("What is the speed of the vehicle in mph? ") print "The speed is " + str(sum) + " mph." y = input("How many hours has it traveled? ") print "The hours it has traveled total is " + str(y) + " hours." sum2 = sum y2 = 1 print "For the 1st hour, the distance traveled was " + str(sum) + " miles." while y > 1: #while loop sum = sum + sum2 #equations y2 = y2 + 1 print "For hour " + str(y2) + "," print "The distance traveled was " + str(sum) + " miles." y = y -1
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question