155,609 views
12 votes
12 votes
Write the syntax.

1. for loop

2. while loop

3. function definition

4. function call

5. do while loop​

User Mahmoud Felfel
by
2.3k points

1 Answer

25 votes
25 votes

Answer:

Step-by-step explanation:

The following syntax's are written in Python and perform a very basic arithmatic operation within the loop of call as an example

1. for x in range(3):

print(x)

2. count = 0

while True:

print(count)

count += 1

if count == 4:

return False

3. def next_pow2():

return 3**2

4. next_pow2()

5. i = 1

while True:

print(i)

i = i + 1

if(i > 3):

break

#Python doesn't have an explicit do-while loop but can be emulated exactly as a do-while loop using the format written in answer 5.

User PBelanger
by
3.1k points