Increment operators in Python

0 votes
Does python have unary increment and decrement operators, like in C?
May 11, 2018 in Python by kaalabilli
• 1,090 points
68 views

1 answer to this question.

0 votes

Python has no unary operators. So use the "shorthand" operators instead.

See below:

i += 4     #increment by 4
j -= 2     #decrement by 2
answered May 11, 2018 by Hamartia's Mask
• 1,580 points

Related Questions In Python

0 votes
1 answer

Can someone explain the behaviour of increment and decrement operators in python

down voteaccepted ++ is not an operator. It is ...READ MORE

answered May 15, 2018 in Python by ariaholic
• 7,320 points
264 views
0 votes
1 answer

Behaviour of increment and decrement operators in Python

When you want to increment or decrement, ...READ MORE

answered Jul 26, 2018 in Python by Priyaj
• 56,160 points
496 views
0 votes
1 answer

what are "and" and "or" operators in Python?

AND - True if both the operands ...READ MORE

answered Apr 17, 2018 in Python by Johnathon
• 9,070 points
33 views
0 votes
1 answer

Increment with ++ in Python

Python doesn't support ++, so we use: number ...READ MORE

answered Nov 8, 2018 in Python by SDeb
• 12,280 points
36 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 128 views
+4 votes
6 answers
0 votes
1 answer

Do-while loop in Python

Python does not have a do-while construct.  If ...READ MORE

answered May 11, 2018 in Python by Hamartia's Mask
• 1,580 points
83 views
0 votes
1 answer

Binary numbers in python

>>> 0b1011 11 READ MORE

answered Jun 6, 2018 in Python by Hamartia's Mask
• 1,580 points
14 views