+ 10

In python 3, why do i get an 8 multiple

Print(1,020,003)

26th Feb 2019, 12:33 AM
Mark
8 ответов
+ 7
Yes. In some versions of python 3 you get a syntax error, however in the newer ones you get this: print(1,020,000) Answer is: 1 8 0 Why is there an 8 there when there should be a 2 or 20? If you put a 3 instead of 2 you will get 16. It increments by 8 proportionately as you increase the middle number. It does the same for the last set of zeros on the million integer. I hope that clears my question. Please someone tell me why. Thanks 😊
26th Feb 2019, 5:12 AM
Mark
+ 7
Hmmmmm? Well thank you for that info 😊
26th Feb 2019, 5:19 AM
Mark
+ 7
Thank you so very much Diego. You're a genius!🙏
26th Feb 2019, 5:24 AM
Mark
+ 5
Yeah... I can't seem to reproduce the issue/output.
26th Feb 2019, 12:55 AM
Fermi
Fermi - avatar
+ 5
Your question is vague. Please add more information.
26th Feb 2019, 2:25 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 4
Please elaborate on your question. I get a SyntaxError: invalid token.
26th Feb 2019, 12:40 AM
Diego
Diego - avatar
+ 3
For Python 2: print 1, 020, 003 For Python 3: print(1, 0o20, 0o03)
26th Feb 2019, 5:22 AM
Diego
Diego - avatar