Answers for "python do loop"

37

for loop python

Python Loops

for x in range(1, 80, 2):
  print(x)

words=['zero','one','two']
for operator, word in enumerate(words):
	print(word, operator)

for x in range(1, 80, 2):
  print(x)
Posted by: Guest on April-07-2020
52

python do while

# Python does not have a do-while loop. You can however simulate
# it by using a while loop over True and breaking when a certain
# condition is met.
# Example:
i = 1
while True:
    print(i)
    i = i + 1
    if(i > 3):
        break
Posted by: Guest on March-03-2020
0

python for loop

for i in range(5):
  print(i)
# Output:
# 0
# 1
# 2
# 3
# 4
my_list = ["a", 1, True, 4.0, (0, 0)]
for i in my_list:
  print(i)
# Output:
# a
# 1
# True
# 4.0
# (0, 0)
Posted by: Guest on January-30-2021
0

For Loop in Python

for i in range(start, stop, step):
    # statement 1
    # statement 2
    # etc
Posted by: Guest on May-18-2021
0

python for loop

n = int(input("All numbers in given range"))
for i in range(n):
  print(i)
Posted by: Guest on April-09-2021
0

python for loop

#an object to iterate over 
items = ["Item1", "Item2", "Item3", "Item4"]

#for loop using range  
for i in range(len(items)):
  	print(items[i])
    
#for loop w/o using range    
for item in items:
  	print(item)
Posted by: Guest on November-01-2020

Python Answers by Framework

Browse Popular Code Answers by Language