0

New to programing as a whole and trying to self teach myself python3 through Udemy courses and what not. Doing an exercise where I've been tasked the easy problem of assigning a tuple to the color_codes variable that consist of 3 tuples inside the tuple.

color_codes = (("red","blue","green"),(01,02,03),(1.1,2.2,3.3))

Above gives me syntax error that points to the middle tuple (01,02,03). My question is why doesn't this work? I played around and got the code to work by taking out the 0's but I dont know why this fixed the issue.

A brief explanation why plus a link to some doc's where I can read further why this doesn't work would be greatly appreciated.

I expected above to work as intended and just assign the tuple to variable color_codes. I got it to work by taking out the zeros in (01,02,03) but i dont know why this worked.

  • The syntax error that you get is very specific: `leading zeros in decimal integer literals are not permitted`. I'm not sure why you were focusing on the syntax of tuples. – John Coleman Nov 20 '22 at 00:50

0 Answers0