Computer Science, asked by ghumansukh26, 2 months ago

Write the output of the following:
num1= 4 num2= num1+1
num1= 2 print(num1, num2)​

Answers

Answered by allysia
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