0

Having trouble understanding why this won't run on my desktop:

def dig(x): y=0 for anything in range(x): y += anything return y pint (dig(10))

7th Mar 2018, 1:55 PM
Msizi
5 Answers
+ 7
There are 2 errors The y += anything line has to be indented in the for loop. pint() doesn't work. Try print() 😉
7th Mar 2018, 2:28 PM
David Ashton
David Ashton - avatar
+ 1
if this is in python, you must indent correctly the for body
7th Mar 2018, 2:02 PM
KrOW
KrOW - avatar
+ 1
Of course. Thankyou sir.
7th Mar 2018, 2:34 PM
Msizi
0
True. Only exaggerated to make it viewer-friendly.
7th Mar 2018, 2:04 PM
Msizi
0
Notwithstanging, I figured this program should run in the playground. "Why not on a desktop?" I remain clueless.
7th Mar 2018, 2:06 PM
Msizi