0

hi guys can you tell me what is wrong with my code?

speed = int(input("please enter the speed(kilometer per hour)")) distance = int(input("please enter the distance (per meter)")) color = str(input("please enter the light of stoplight")) green = 1 red = 0 if speed > 100: if distance < 100: if color == red: print("break") elif color == green: print ("keep going") if speed>120: if distance<200: if color==red: print("break") elif color==green: print ("keep going") if speed > 130: if distance < 300: if color == red: print("break") elif color == green: print("keep going") this is my python code there is no error but it doesnt work!

12th Jul 2021, 7:08 AM
Madara Uchiha
Madara Uchiha - avatar
2 Antworten
+ 2
If speed > 130, it is also>120,100
12th Jul 2021, 7:12 AM
Oma Falk
Oma Falk - avatar
0
It only works if speed bigger than 100, and distance smaller than 300. Last line has an indent error.
12th Jul 2021, 7:12 AM
Paul
Paul - avatar