-6

This the source code:

 while (1):
     num =input("please enter for array  or  for lunch index array enter\"lunch\"")
     hh=[]
     p=int(len(hh))
     print(p)
     print(type(p))
    
     if(num=="lunch"):
      print(hh)
     elif(num=="end"):
      break
     else:
       cc=0
       for cc in p :
        hh.append(i,num)
        cc+=1
     print(hh)

This is the error I am getting:

Traceback (most recent call last):
  File "D:\python project\array.py", line 14, in <module>
    for cc in p :
TypeError: 'int' object is not iterable

Why am I getting a TypeError? And please explain what is a iterable...

1 Answers1

0

Iterables are objects that have multiple items and support iteration protocol So lists, tuples, strings are iterable and integers are not

Roman Nakutnyi
  • 791
  • 7
  • 11