Write the output of the following:
num1= 4 num2= num1+1
num1= 2 print(num1, num2)
Answers
Answered by
5
Program:
num1=4
num2= num1+1
num1= 2
print(num1, num2)
Output:
2 5
Explanation:
num1=4 #assigns num1 the value of 4
num2= num1+1 #num1+1 same as 4+1 = 5 is assigned to num2.
num1= 2 #num1 has assigned a new value of 2
print(num1, num2) #num1 has now the value of 2 and num2 has value of 5.
Similar questions
Social Sciences,
1 month ago
Political Science,
1 month ago
Math,
2 months ago
English,
2 months ago
Math,
9 months ago
English,
9 months ago