please help. I am still very new to programming. was trynig to figure out the error that occurs you create a variable like this : variable= 0124
MIT 6.00 Intro Computer Science (OCW)
Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
Is this a theoretical question or are you actually writing a program and you 're getting some error?
If second case, please provide programming language and output error.
yeah I support your answer @nbarrere_t if its not a theoritical question then provide a programming langauge and output error.thats the only way we can help you.
The only errors that that statement can cause is that "variable" could be a reserved word by the language, it isn't in Python. The statement WILL give a surprising result: the leading zero means that 1234 is octal (base 8).
>>> variable = 01234
>>> print variable
Not the answer you are looking for? Search for more explanations.
Or to expand on why some people said it is language based, if you are in C, Java, or many others, you would need to tell it the type of variable:
int variable = 01234
See, Python is dynamically strong typed. It uses what it sees about the input to determine the type. So as rsmith points out, the 0 at the start tells it to make an octal input. If it had quotes around it then it would fo it as a string. () make a tuple. On and on, Pythin automatically tupes, but once typed you can not simply use it as another type without reassigning to the needed type. That makes it strongly typed even though it is dynamic.
C, C++, Java, BASIC, and a whole host of others want the variable type clearly written. There is nothing dynamic about them.