Answers for "python iterate"

54

python loop through list

list = [1, 3, 6, 9, 12] 
   
for i in list: 
    print(i)
Posted by: Guest on June-25-2019
4

loop through python object

for attr, value in k.__dict__.items():
        print(attr, value)
Posted by: Guest on February-29-2020
0

iterate through objects with python

class C:
    a = 5
    b = [1,2,3]
    def foobar():
        b = "hi"    

for attr, value in C.__dict__.iteritems():
    print "Attribute: " + str(attr or "")
    print "Value: " + str(value or "")
Posted by: Guest on August-16-2020
1

how to use iteration in python

for i = 1 to 10
    <loop body>
Posted by: Guest on February-29-2020
1

for i in a for j in a loop python

for i, j in zip(range(x), range(y)):
  ...
Posted by: Guest on March-02-2020
1

how to iterate over a list in python

lst = [10, 50, 75, 83, 98, 84, 32] 
 
res = list(map(lambda x:x, lst))
 
print(res)
Posted by: Guest on July-23-2020

Python Answers by Framework

Browse Popular Code Answers by Language