So, I've been working on this problem for a while now and have done research and double checked my code but I can't figure out whats wrong.
The problem I'm having is when I try to print OR return a string it isn't doing anything. If I take the strings out separately they work fine. Here's part of my code. (I have two sections of code like this and neither are doing anything the first has if and elif and the second if and else)
speed=int(input("Expected average speed in MPH?"))
def response(speed):
if speed > 80:
print "Your travelling dangerously fast, as well as breaking the law. Slow down."elif speed < 60:
print "Your going slow. Please speed up to not be a hinderance to other traffic."
This part of my code isn't showing up in the final result. I can't think of what I could be doing wrong. Whereas if I just did this it works fine.
enter=int(input("Enter I-15 at what mile marker?"))
exit=int(input("Exit I-15 at what mile marker?"))
def milestotravel(exit, enter): return abs(exit-enter)
print ("You will travel: "+str(milestotravel(exit, enter))+" miles.")
Aucun commentaire:
Enregistrer un commentaire