Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

closed While loops with integers in python

+2 votes
asked Sep 21 by Ben Roberts (210 points)
closed 3 days ago by Ben Roberts
I’m making a game and I need to use a while loop
closed with the note: It was answered

2 Answers

0 votes
answered 6 days ago by Pradeep Pant (180 points)
syntax for while loop is

while(condition):

          body of loop

          next_iteration

first statement after while loop

Example : you want to print hello 10 times and end one times using while loop

i=1;                #initialization

while( i<=10):      #condition

      print("Hello")       #body of loop

      i=i+1                # next iteration

print("end")            //outside the while loop
0 votes
answered 6 days ago by Peter Minarik (58,220 points)

Have a look at this.

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...