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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...