Jump to content
Sign in to follow this  
hisoka

python interpreter

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 ??

 

Share this post


Link to post
Share on other sites

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

 

b was probably set to 3 earlier.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×