>>> a=3
>>> a+2.0
5.0
>>> a=a+1.0
>>> a
4.0
Can’t understand why 4.0 is coming. I think 6.0 should be the answer. Please explain why the result is 4.0.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
On the second line when you do
a+2.0, you are not modifying the value ofa, so on the third lineais still3anda+1.0is4.0as expected.