Informatics Practices
Give the output.
a, b, c = 10, 20, 30
p, q, r = c - 5, a + 3, b - 4
print(p, q, r)
Answer
25 13 16
Working
In the given code, using multiple assignment, three variables a, b, and c are initially assigned values 10, 20, and 30 respectively and variables p, q, and r are assigned new values: p is assigned c - 5 (resulting in 25), q is assigned a + 3 (resulting in 13), and r is assigned b - 4 (resulting in 16). When print(p, q, r) is executed, it outputs 25 13 16, representing the values after the assignments.
Related Questions
Predict the output:
x, y = 20, 60 y, x, y = x, y - 10, x + 10 print (x, y)Predict the output:
a, b = 12, 13 c, b = a*2, a/2 print (a, b, c)Find the errors in following code fragment : (The input entered is XI)
c = int (input ( "Enter your class") ) print ("Your class is", c)Find errors in the following code fragment.
cl = input("Enter your class") print("Last year you were in class", cl - 1)