TypeError : l'objet 'int' n'est pas itérable
Solved
Lulupoulet
Posted messages
9
Status
Member
-
Lulupoulet Posted messages 9 Status Member -
Lulupoulet Posted messages 9 Status Member -
Bonjour,
I have the error "TypeError: 'int' object is not iterable" when I run my Python program which is:
And the error message is:
Since my level in Python is close to zero, I can't solve this problem. That's why I'm asking if you would mind helping me even if the error is obvious to you.
Thank you in advance.
I have the error "TypeError: 'int' object is not iterable" when I run my Python program which is:
import random k = random.randint(1, 82) for i in range(1,82): if i * k < 82 : i * k < 82 == n k == random.randrange(min(n), max(n)) print(k) elif i % k == 0 : i % k == b k = random.randrange(min(b),max(b)) print(k) else: break
And the error message is:
line 6, in <module> k == random.randrange(min(n), max(n)) TypeError: 'int' object is not iterable
Since my level in Python is close to zero, I can't solve this problem. That's why I'm asking if you would mind helping me even if the error is obvious to you.
Thank you in advance.
1 answer
yg_be
Posted messages
23437
Registration date
Status
Contributor
Last intervention
Ambassadeur
1 588
Hello,
we will be able to advise you more easily if you explain what you are trying to achieve by writing
I notice that line 6 you shared is different from the one in the error message. Strange, isn't it?
Can you make sure to use the code tags when you share code?
The syntax of your line 5 (and other lines) seems strange to me: what are you trying to do with it?
we will be able to advise you more easily if you explain what you are trying to achieve by writing
int(n).
I notice that line 6 you shared is different from the one in the error message. Strange, isn't it?
Can you make sure to use the code tags when you share code?
The syntax of your line 5 (and other lines) seems strange to me: what are you trying to do with it?
I also suggest that you add print statements to understand the behavior of your program.
What documentation do you use to write in Python? I feel like you are inventing a new programming language.