Where is my mistake?

Hi Maho

The error is in the for statement
for i in (len(values1)):
len(values1) is not iterable, it is just an integer.
So, it should have been range(len(values1)).

Hope this helps.

1 Like

Hi @Maho,

Could you please follow these guidelines for asking Technical questions when you ask future questions? It will help other people with similar doubts to get answer without asking the same questions in the future. It also helps whoever answering your question to get the context faster. Thank you for considering this request. Happy learning.

1 Like

Thank you, I have already read those guidelines.
I promise you that I will act on those guidelines, but guideline 3 is a little difficult to apply and I think screenshots like the one above help more.

Thanks for the clarification.

Hi @Maho,

Good to know that you have read those guidelines.

I agree that screenshots like above will help to ask the question easily and quickly.

  • But when we try to write down a question and try to formulate what we need to ask, we think more about the problem and sometimes we end up finding a solution all by ourselves in that process.
    Probably that is why guideline #1 is Format all code using Markdown - no screenshots.

I understand from my experience that it is easier to ask question here and get an answer when we are stuck. But there is a sense of accomplishment when we search on our own for the solution on google or stackoverflow and find a solution all by ourselves. When we as a beginner do that, it boost our confidence tremendously.
For example, in this problem, if you wanted to troubleshoot by yourself, you could copy and paste the error code " β€˜int’ object is not iterable" on google and do a search.

The first result I got is here

You will find a similar issue there as well. And the solution given is also in the similar lines.

Once you do this, soon you will get a hang of troubleshooting such issues on your own and get better at it. This will help you a lot in learning things quickly. I hope this helps.

1 Like

How should I know whether the variable is iterable or not?

You may find this article helpful.

1 Like