GPYC Exam QuestionsBrowse all questions from this exam

GPYC Exam - Question 13


What it the output of the following program when executed with the Python Interpreter?

Show Answer
Correct Answer: C

The initial value of a is 10. The first operation a = a + 5 increases the value of a by 5, making it 15. The second operation a += 5 further increases the value of a by 5, making it 20. Therefore, the output of the program is 20.

Discussion

2 comments
Sign in to comment
AZIrvThoOption: D
Sep 29, 2023

When running this code: a = 10 a += 5 print (a) The answer returned is 15.

cliwanagOption: C
Jan 24, 2024

a = 10 a = a + 5 -> a = 10 + 5 = 15 a += 5 -> a = 15 + 5 = 20