hisoka Posted April 13, 2015 Posted April 13, 2015 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 ??
Ingolme Posted April 13, 2015 Posted April 13, 2015 You're asking it for b, the value you set was a b was probably set to 3 earlier.
hisoka Posted April 13, 2015 Author Posted April 13, 2015 (edited) 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 April 13, 2015 by hisoka
Ingolme Posted April 14, 2015 Posted April 14, 2015 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. 1
hisoka Posted April 27, 2015 Author Posted April 27, 2015 You are right . I made an unconscious error
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now