Jump to content

python interpreter


hisoka

Recommended Posts

In python interpreter prompt command , I got this result :

 

>>> a= 25

>>> b

3

 

>>> a=120

>>> b

3

 

I could not understanding why I got 3 as a result . What is the explanation of getting 3 as a result or why I get 3 as a result ??

 

Link to comment
Share on other sites

You're asking it for b, the value you set was a

 

b was probably set to 3 earlier.

 

 

No no I did not . I did not assign any value to b

 

I begun the little piece of code like this

 

>>> a = 123

>>> b

(then when I pressed enter ) I got 3 as a result

 

 

believe me

 

now i tried again but when I pressed enter I got this error :

 

 

name 'b' is not defined

 

now a value should assigned to b

 

Now I assigned a value to be b and now it is printed normally but before the result was 3

Edited by hisoka
Link to comment
Share on other sites

It's impossible to know now whether you gave b a value or not, but computers only do what they're told. If b had a value it's almost certainly because somebody set that value.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...