+ 1

I have problem understanding while loop

Can someone help me out with it?

28th Jul 2025, 3:08 PM
Mercy
Mercy - avatar
16 Respostas
+ 8
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
What I need to do is to go the code get the link and post
28th Jul 2025, 4:09 PM
Mercy
Mercy - avatar
+ 2
Aleksei Radchenkov thanks Corrected it already
28th Jul 2025, 5:16 PM
Mercy
Mercy - avatar
+ 2
A while loop keeps running as long as a condition is True. Simple example: count = 1 # start at 1 while count <= 5: # repeat while count is less than or equal to 5 print("Number:", count) count = count + 1 # increase count by 1 each time
29th Jul 2025, 6:26 PM
SAIFULLAHI KHAMISU
SAIFULLAHI KHAMISU - avatar
+ 2
SAIFULLAHI KHAMISU this is not a code advertisement thread. Please use the six threads available. https://sololearn.com/compiler-playground/WvG0MJq2dQ6y/?ref=app
29th Jul 2025, 11:22 PM
BroFar
BroFar - avatar
+ 2
I am Fake , you are at the right place here. sololearn is a `self-learner` platform. you can learn from the supplied tutorials at your own pace. since you have already started with 2 tutorials - you could continue with these. if it is not what you have expected, the following may help you to decide: > if you are interested in ``web development``, you could start with the tutorial *web development*. it is a compilation of some individual tutorials: *introduction to html*, *introduction to css*, *introduction to javascript*. but you can also start with the mentioned independent tutorials. > if you are interested in app development, you can try *java*, *c*, *c#*, *c++*. just use the *introduction to ...* of the mentioned courses. > if you are not quite sure and you want just getting into coding, you can start with the tutorial *introduction to python*. if you get stuck somewhere in your learning journey, you can post a question here.
30th Jul 2025, 5:37 PM
Lothar
Lothar - 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
+ 1
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
28th Jul 2025, 4:04 PM
Aleksei Radchenkov
Aleksei Radchenkov - avatar
+ 1
Yes
28th Jul 2025, 4:09 PM
Mercy
Mercy - avatar
+ 1
Sure! A while loop is a way to repeat something over and over again as long as a specific condition is true. Think of it like this: "If this is still true, keep doing it." As soon as the condition is no longer true, it stops. For example, imagine you're filling a glass of water. You keep pouring while the glass is not full. Once it's full, you stop — that’s how a while loop works. If you share what exactly confuses you, I can explain more clearly
29th Jul 2025, 2:47 PM
Karl
29th Jul 2025, 7:49 PM
SAIFULLAHI KHAMISU
SAIFULLAHI KHAMISU - avatar
+ 1
https://sololearn.com/compiler-playground/cbG225pbu29M/?ref=app
29th Jul 2025, 10:38 PM
SAIFULLAHI KHAMISU
SAIFULLAHI KHAMISU - avatar
+ 1
I am beginer and not understand anything here
30th Jul 2025, 2:28 PM
I am Fake
I am Fake - avatar