I have the following statement:
for i, char in enumerate(list(range(100))):
now i just want to print the value, where char is equal to 50.
I have tried the following idea, but did not understand why it is incorrect:
for i, char in enumerate(list(range(100))):
char == 50
print(i)
The solution is that I have to put an "if" statement, i already understood the logic behind it but also want to ask, why my approach is not valid.
Thanks for helping in advance.
Aucun commentaire:
Enregistrer un commentaire