Where is the problem?While loop is not working.I want to start my sentence to write from end.Sorry my english. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Where is the problem?While loop is not working.I want to start my sentence to write from end.Sorry my english.

https://code.sololearn.com/cjZbJrghqsh2/?ref=app

14th Aug 2017, 8:11 PM
Emrah Şahan
Emrah Şahan - avatar
3 Answers
+ 3
While loop works when the condition is true. But in your program, the condition is 'count==0'. This means while loop will only work when count is 0. But if you input something, count becomes the count of sentence, not 0. So change 'count==0' to 'count!=0'. Then it will work.
15th Aug 2017, 1:40 AM
OrbitHv [Inactive]
OrbitHv [Inactive] - avatar
+ 2
First recommendation: write comments explaining what you are trying to achieve. By looking at your code, I pressume you want to print the words in reverse order. the reason it doesn't work is because the condition inside the while loop is always false. count is always going to be bigger than 0 (unless the user does not type anything). therefore this happens count == 0 #false you should check for whenever count is bigger than 0 count > 0 # true then your while loop should work
15th Aug 2017, 1:41 AM
Alejandro Aristizabal
Alejandro Aristizabal - avatar
0
thanks.
15th Aug 2017, 6:30 AM
Emrah Şahan
Emrah Şahan - avatar