Computer Science

Predict the output:


x = 40
y = x + 1       
x = 20, y + x    
print (x, y)

Python

Python Funda

63 Likes

Answer

Output

(20, 81) 41

Explanation

  1. x = 40 ⇒ assigns an initial value of 40 to x.
  2. y = x + 1 ⇒ y = 40 + 1 = 41. So y becomes 41.
  3. x = 20, y + x ⇒ x = 20, 41 + 40 ⇒ x = 20, 81. This makes x a Tuple of 2 elements (20, 81).
  4. print (x, y) ⇒ prints the tuple x and the integer variable y as (20, 81) and 41 respectively.

Answered By

23 Likes


Related Questions