Oct-17-2018, 05:16 PM
For the whole file I used tabs. I used vim. It did not run well.
It is really amazing ! How interpreter finds you used tabs and not spaces ???
sylvain@sylvain-HP-Laptop-15-bw0xx:~$ cat new2.py #!/usr/bin/python3 #!/usr/bin/env python3 #new2.py def silly(n, x): m=n stack = [iter(range(m))] total=0 while stack: try: i = stack[-1].__next__() except StopIteration: stack.pop() continue total += i if total >= x: break if i == 5: m -= 1 stack.append(iter(range(m))) return total print(silly(1,2)) print(silly(0,1)) print(silly(2,3)) print(silly(3,4)) sylvain@sylvain-HP-Laptop-15-bw0xx:~$The first is for try: Instead of tabs I use spaces. Error repaired. Next error is for the next line.nd
It is really amazing ! How interpreter finds you used tabs and not spaces ???