Enrollments Open for Advanced Certification Courses on Data Science, ML & AI by E&ICT Academy IIT RoorkeeApply Now
When it comes to updating the existing variable, we need to re-assign it after updating its value,
a = a + 1
It gets the current value of
1, and then updates
a with the new value.
If we try to update a variable that is not yet assigned any value i.e. it doesn't exist, you get an error, because Python evaluates the right side before it assigns a value to
Therefore, before updating, we need to initialize the variable,
a = 0 a = a + 1 a = a - 1 a = a * 2 a = a // 3
Try updating a random variable which hasn't been initialized and observe the error.
No hints are availble for this assesment
Answer is not availble for this assesment