nerdexam
CompTIA

PT0-002 · Question #83

Which of the following expressions in Python increase a variable val by one (Choose two.)

The correct answer is C. val=(val+1) F. val+=1. https://pythonguides.com/increment-and-decrement-operators-in-python/

Tools and Code Analysis

Question

Which of the following expressions in Python increase a variable val by one (Choose two.)

Options

  • Aval++
  • B+val
  • Cval=(val+1)
  • D++val
  • Eval=val++
  • Fval+=1

How the community answered

(43 responses)
  • A
    2% (1)
  • B
    5% (2)
  • C
    91% (39)
  • E
    2% (1)

Explanation

https://pythonguides.com/increment-and-decrement-operators-in-python/

Topics

#Python#Variables#Operators#Increment

Community Discussion

No community discussion yet for this question.

Full PT0-002 Practice