Answers for "for loop in python 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
6

for element in array python

itemlist = []
for j in range(len(myarray)):
    item = myarray[j]
    itemlist.append(item)
Posted by: Guest on May-14-2020
1

for loop in python array

for x in range (1, 100, 1):
  print(x)
Posted by: Guest on July-22-2020

Python Answers by Framework

Browse Popular Code Answers by Language