0
How can I stop the loop
try: num=input("miles or Kilometers") def Conversion(num): if num=="miles": miles=int(input("how many miles")) if num==0: print("thanks for using the converter") else: Kilometers=miles*1.609344 print(Kilometers) print(Conversion(num)) elif num=="Kilometers": Kilometers=int(input("how many Kilometers")) if num==0: print("thanks for using the converter") else: miles=Kilometers/1.609344 print(miles) print(Conversion(num)) Conversion(num) except: print("thanks for using the converter")
3 Respuestas
+ 1
Is this the complete code?
I can't see a loop anywhere in that code ...
I see try ... except and if ... elif ... else but no loop. Where is the loop?
I recommend you to share your code link instead, you won't have to worry about character limits by sharing code link, it's safer and easier to analyse.
https://www.sololearn.com/post/75089/?ref=app
+ 1
1. for i in range(5):
print(i)
break
2. x=3
while x<5:
print("hello")
x=6
+ 1
When you run the code
It always asks the same input over and over