0

I have problem understanding while loop

Can someone help me out with it?

28th Jul 2025, 3:08 PM
Mercy
Mercy - avatar
9 Réponses
+ 4
The code should be seat =5 while seat > 0: print("sell pizza") seat = seat -1 # subtraction not addition https://sololearn.com/compiler-playground/cgzdrCcAMnBT/?ref=app
28th Jul 2025, 5:09 PM
BroFar
BroFar - avatar
+ 3
Mercy , the link you posted does not work properly. > to give you support, we need to see your code try, so please copy your code and insert it in your post. > we also need to know the programming language you are using for the while loop issue.
28th Jul 2025, 3:49 PM
Lothar
Lothar - avatar
+ 3
Mercy u simply click the share button (three connected dots in the right top corner) and press copy link. As for the code, it didnt work because 1. Your starting variable was 0, hence the loop was skipped entirely, since the condition was not satisfied at start. 2. You can not perform assignment of a variable like that inside a print function.
28th Jul 2025, 4:36 PM
Aleksei Radchenkov
Aleksei Radchenkov - avatar
+ 2
Aleksei Radchenkov thanks Corrected it already
28th Jul 2025, 5:16 PM
Mercy
Mercy - avatar
+ 1
The while loop simply executes whatever is inside of it, if the condition is true. E.g. while(1!=0){i+=1} will increment i by 1 forever, since 1 is never equal to 0. The concept should be fairly straightfoward. If you have some specific aspect of it that u don't understand, please clarify.
28th Jul 2025, 3:50 PM
Aleksei Radchenkov
Aleksei Radchenkov - avatar
28th Jul 2025, 4:04 PM
Aleksei Radchenkov
Aleksei Radchenkov - avatar
+ 1
Yes
28th Jul 2025, 4:09 PM
Mercy
Mercy - avatar
+ 1
What I need to do is to go the code get the link and post
28th Jul 2025, 4:09 PM
Mercy
Mercy - avatar
0
Lothar I don't know how to use the correct link You can help me out
28th Jul 2025, 4:01 PM
Mercy
Mercy - avatar