Can someone find the buck?

Hi all I created a small function. Problem is, It returns 0 where I expect something else. I checked and checked and also modified the code few times, but I don’t see the buck. Now I am not sure if it’s me or the code ;) https://code.sololearn.com/cG13rnCpbYmm/?ref=app

10/13/2019 6:03:00 AM


7 Answers

New Answer


In line 8 add task[i] == 'X' after or


Programming errors are called bugs and not bucks.


Thanks for the fast help. now it does what I expect! https://code.sololearn.com/cCgf53zrWCWV/?ref=app


thanks for the lesson... next time I will remember the difference 👍


if you want a more elegant solution, you can also do it like this. task = list('2=6+8X') print(task) # returning the position of 'x' def findx(): for i in range(len(task)): if task[i] in ['x', 'X']: return i print(findx())


yes, we got that already.