Computer Science
Assertion. Assigning a new value to an int variable creates a new variable internally.
Reason. The int type is immutable data type of Python.
Python Funda
3 Likes
Answer
(a)
Both Assertion and Reason are true and Reason is the correct explanation of Assertion.
Explanation
In python, literal values have fixed memory locations and variable names reference them as values. This means that, although we can change the value of an integer variable, the process involves creating a new integer object with the updated value. Literal values, such as 10, have fixed memory locations, and variables act as references to these values. When we assign a new value to an integer variable, we are essentially creating a new object, and the variable now points to this new object. Hence, both Assertion and Reason are true and Reason is the correct explanation of Assertion.
Answered By
1 Like
Related Questions
Python loops can also have else clause.
In a nested loop, a break statement terminates all the nested loops in one go.
Assertion. """A Sample Python String""" is a valid Python String.
Reason. Triple Quotation marks are not valid in Python.
Assertion. If and For are legal statements in Python.
Reason. Python is case sensitive and its basic selection and looping statements are in lower case.