Answers for "repeat command python"

2

how to reapete the code in python

for i in range(4):  # 4 = number of times you want to run the code
  print("Hello World")
Posted by: Guest on July-12-2020
11

for in python

# how to use for in python for (range, lists)
fruits = ["pineapple","apple", "banana", "cherry"]
for x in fruits:
  if x == "apple":
    continue
  if x == "banana":
    break
  print(x)
# fron 2 to 30 by 3 step
for x in range(2, 30, 3):
  print(x)
Posted by: Guest on March-26-2020

Python Answers by Framework

Browse Popular Code Answers by Language