How can I fix TypeError: 'int' object is not iterable?
N = list(input("Enter long number: "))
Even = []
Odd = []
for i in list (N):
if i % 2 == 0:
Even.count (i)
elif i % 2 == 1:
Odd.count (i)
print (f"Even: {Even}")
print (f"Odd: {Odd}")
CodePudding user response:
can you try this?
N = list(input("Enter long number: "))
Even = []
Odd = []
for i in N:
i = int(i)
if i % 2 == 0:
Even.append(i)
elif i % 2 == 1:
Odd.append(i)
print (f"Even: {Even}")
print (f"Odd: {Odd}")