NEWBIE: 'print 0108' is syntax error?

M

Michael Iles

Please forgive me for posting such an inane question, I just want to
know what's going on here:

-----------------------------------------------------------
Python 2.3 (#46, Jul 29 2003, 18:54:32) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information. File "<stdin>", line 1
print 0108
^
SyntaxError: invalid token File "<stdin>", line 1
print 0109
^
SyntaxError: invalid token73
 
K

Karlheinz klingbeil

Michael Iles wrote:

What's up with octal 108 and octal 109?

nothing.... there's simply no octal 8 or 9 because oktal means "up to eight"
or - in programmers terms "0 to 7"
 
D

Derrick 'dman' Hudson

Michael Iles said:
Please forgive me for posting such an inane question, I just want to
know what's going on here:
[/QUOTE]
^
Octal (base 8) number.
Decimal (base 10) equivalent
again


again

File "<stdin>", line 1
print 0108
^
SyntaxError: invalid token

8 is not a valid octal digit.
File "<stdin>", line 1
print 0109
^
SyntaxError: invalid token

again, 9 is not a valid octal digit

This is the next number, in octal representation.

They don't exist.

-D

--
If you want to know what God thinks about money,
just look at the people He gives it to.
-- Old Irish Saying

www: http://dman13.dyndns.org/~dman/ jabber: (e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,169
Messages
2,570,919
Members
47,459
Latest member
Vida00R129

Latest Threads

Top