Exam PT0-003 Topic 2 Question 163 Discussion
Actual exam question for CompTIA's PT0-003 exam
Question #: 163
Topic #: 2
Question #: 163
Topic #: 2
Which of the following expressions in Python increase a variable val by one (Choose two.)
Suggested Answer: C,F Vote an answer
In Python, there are two ways to increase a variable by one: using the assignment operator (=) with an arithmetic expression, or using the augmented assignment operator (+=). The expressions val=(val+1) and val+=1 both achieve this goal. The expressions val++ and ++val are not valid in Python, as there is no increment operator. The expressions +val and val=val++ do not change the value of val2.
https://pythonguides.com/increment-and-decrement-operators-in-python/
https://pythonguides.com/increment-and-decrement-operators-in-python/
by Hilda at Jun 25, 2026, 04:48 AM
Contact Us
If you have any question please leave me your email address, we will reply and send email to you in 12 hours.
Our Working Time: ( GMT 0:00-15:00 ) From Monday to Saturday
Support: Contact now
Comments
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Report Comment
Commenting
You can sign-up / login (it's free).