Hi
Can somone tell me what I doing wrong in this loop thanks
You are not using indentation. The line after for, if, elif and else requires an indent.
It should be:
for x in y:
if z=c:
answer = 1
else:
answer = 2
etc…
Take a look here: https://wiki.python.org/moin/ForLoop
Also don’t use capital letters for variables (in your case Answer should be answer) and remove the square brackets
I dont understand what is an indent
lucamanzon is right. You need to indent after you started a loop (one “TAB” to the right).
And i if your need only one result, you don’t need to create a list.
If you need a result for every item in the list, use append.
Do you understand what I am trying to write or achive with the loop or is it impossible to understand? How would you write it?
thanks
You asked what was wrong and I told you.
This is not a “do my job” forum, I explained you the mistakes so you could learn something