+ 1
What I have done wrong
h="yes" while h=="yes": n=int(input("Enter the first number")) m=int(input("Enter yhe second number")) o=input("Enter any operator") if o=="+": print(n+m) elif o=="-": print(n-m) elif o=="*": print(n*m) elif o=="/": print(n/m) h=input("Do you want to continue") if h=="n": print("Thanks for using‚by Tech")
7 ответов
+ 6
Are you running this code in SoloLearn? FYI SoloLearn Code Playground does not support interactive input/output. Your code requires input in a loop, thus it's rather tricky to run in SoloLearn.
Please add Python in the post tags for relevance sake.
+ 6
Your code is running and you want to program run infinity when the user want but it can't be possible on sololearn app or any other simple online compiler.
You can try on repelit or if you use computer then try on VS code.
+ 3
Sakshi what is replit? are you talking about online IDE replit or does it mean something else?
+ 2
Sakshi thanks for the clarification! :)
+ 2
Thank you so much guys👏👏👏
+ 1
Sandeep yaa, I was talk about IDE repelit
+ 1
There seem to be a couple of issues with this code:
Indentation: In Python, indentation is used to denote the scope of code blocks. However, the code block inside the while loop is not properly indented. The code inside the while loop should be indented by four spaces or one tab.
Typo: There is a typo in the second input statement where yhe is used instead of the. This will cause a NameError to be raised when the code is executed.