I was trying to solve the exercise but could not get the answer.
I tried doing the exercise but could not get the answer.
I am pasting my code, please let me know what is my mistake.
total = 0
while numbers[total] < 20:
print (total =+ 1)
Also, why can't I use statements like
while x in nums:
print total =+1
Whats wrog with this code ?
Thanks for reaching out.
In both examples, you are trying to increment a value (i.e. the value of 1) to a variable in the argument of a print function, while you need to do that outside the print function (still in the while loop). Please correct this and retry running the functions.
Hope this helps.