Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7413361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:40:59+00:00 2026-05-29T06:40:59+00:00

We can not declare an integer which start with 0. >>> n = 08

  • 0

We can not declare an integer which start with 0.

>>> n = 08
SyntaxError: invalid token

But we do declare a variable that contains all zeros.

>>> n = 00000
>>> print n
>>> 0

So the question is in first case why python just not consider value of variable to n = 8 by ignoring the zero on left side instead of raising an exception. As in second case it is still considering all zeros to a valid value.

Consider another case.

>>> n = '0008'
>>> print int(n)
>>> 8

Now in third case it is still considering it a valid numeric value, why an exception is not raised here??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:41:00+00:00Added an answer on May 29, 2026 at 6:41 am

    Numbers beginning with 0 and containing no decimal point are interpreted as octal (using digits 0-7). 08 is not a valid octal number. According to the PEP Index, “the ability to specify an octal number by using a leading zero will be removed from the language in Python 3.0 (and the Python 3.0 preview mode of 2.6), and that a SyntaxError will be raised whenever a leading “0” is immediately followed by another digit” can be found here http://www.python.org/dev/peps/pep-3127/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can i solve must declare a body because it is not marked abstract,
I have integer type field in database which is having property Not Null. when
Is it normal, that declaring NSString c=a sample string; cannot work, and must declare
Can not run following SQL from ant's sql task : BEGIN DBMS_AQADM.CREATE_QUEUE_TABLE( queue_table =>
I can not distinguish the difference between aggregating and holding. What does it mean
I can not control the scrolling of a scrollpane from within my actionscript (I
I can not get to make this comparison in this simple code error ..
I can not get logs from some customers, can I use Google Urchin in
I can not seem to figure out how to count the number of seconds
I can not find how to implement a design in C++. In the language

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.