Answers for "python for loop for an array"

5

python for loop with array

foo = ['foo', 'bar']
for i in foo:
  print(i) #outputs 'foo' then 'bar'
for i in range(len(foo)):
  print(foo[i]) #outputs 'foo' then 'bar'
i = 0
while i < len(foo):
  print(foo[i]) #outputs 'foo' then 'bar'
Posted by: Guest on July-18-2020
-1

python for loop array

print("Hello, world")
Posted by: Guest on March-20-2021

Python Answers by Framework

Browse Popular Code Answers by Language