0
while True: print("Options:") print("Enter 'add' to add two numbers") print("Enter 'subtract' to subtract two number
i cant understand this code. is there anyoone to explain this
4 odpowiedzi
+ 1
First up, it's an error, you didn't close the " and ) on the last line...
0
this code will keep repeating the three lines of text. I expect that after this there is a prompt to the user to fill in the text, but this code only displays the text.
while will keep repeating the code until the condition is false. because it isn't a check like i<5 it will only stop if the loop is aborted with a return or break
0
thnks all
- 1
its calculator....
the coder is giving u the way by tht u can add or substract or multiply numbers...
while True:
# this part always executes ...if you give a break statement...in while loop then on that satisfying condition the loop breaks out..
usually while loop is used because...
u and user both dont know where to stop...
or when to stop..
u may have to use that program for calculation fr an hour or fr some minute...
suppose theres a input in that while loop..
and whenever the input is "n" it breals through the loop...
and continue if the input is "y" or anything else...
i hope u understood