Python doesn't support ++, but you can do:

number += 1
Answer from Daniel Stutzbach on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › g-fact-21-increment-and-decrement-operators-in-python
Increment += and Decrement -= Assignment Operators in Python - GeeksforGeeks
Additionally, the range() function is utilized in a for loop to showcase both incrementing and decrementing loops, providing a Pythonic alternative to traditional increment and decrement operators found in some other programming languages. ... # A sample use of increasing the variable value by one. count = 0 count += 1 count = count+1 print('The Value of Count is', count) print("INCREMENTED FOR LOOP") for i in range(0, 5): print(i) # this is for increment operator here start = 5, # stop = -1 and step = -1 print("\n DECREMENTED FOR LOOP") for i in range(4, -1, -1): print(i)
Published   April 30, 2024
Discussions

Best way to increment of 1 in python?

I tend to just do

i += 1

But then again, I'm not as nifty.

More on reddit.com
🌐 r/Python
84
34
June 18, 2011
How to increment a counter by one each time a sequence is played out (rock, scissors, paper)
counter+=1 anywhere in your loop. More on reddit.com
🌐 r/learnpython
9
0
July 13, 2023
How can I increment i with an additional value within a for loop?
Firstly, the i += 1 part of your code does nothing. Second, the range function can take up to three arguments. When you pass all three, the first is the starting number, the second is the last number (but remember that Python uses half-open intervals), and the last is the step. So you'd do for i in range(0, 4, 2): print(i) More on reddit.com
🌐 r/learnpython
11
2
May 27, 2022
How to increase a variable by 1 in Python
TIL that Python isn’t as harmless as it looks like More on reddit.com
🌐 r/ProgrammerHumor
13
127
September 13, 2022
🌐
The Renegade Coder
therenegadecoder.com › code › how-to-increment-a-number-in-python
How to Increment a Number in Python: Operators, Functions, and More – The Renegade Coder
May 28, 2024 - First, we could use direct assignment: x = x + 1. Alternatively, we could use the condensed increment operator syntax: x += 1. In addition, there are a few less conventional options like using the add method of the operator module or using generator ...
🌐
iO Flood
ioflood.com › blog › python-increment-by-1-quick-and-easy-examples
Python Increment By 1 | Quick and Easy Examples
March 12, 2024 - So, if you’re ready to take this Python journey, let’s start climbing! To increment a variable x by 1 in Python, you can use the addition assignment operator +=. The expression x += 1 means increase the value of x by 1.
🌐
AskPython
askpython.com › home › python increment by 1
Python increment by 1 - AskPython
December 7, 2022 - To increment a variable by 1 in Python, you can use the augmented assignment operator +=. This operator adds the right operand to the left operand and assigns the result to the left operand.
🌐
Reddit
reddit.com › r/python › best way to increment of 1 in python?
r/Python on Reddit: Best way to increment of 1 in python?
June 18, 2011 -

I search for better function to increment a number of 1

So far I have found the following suggestions:

# recursive abacus
def inc(x,n=0): return inc(x^(1<<n),inc(0,n)) if x&(1<<n) else x|x^(1<<n)

# there are 10 type of coders ...
lambda i: i++ (lambda j: j()**j())(type(i)) #halike

# dyslexia
lambda i: (sum(range(x))*2)/x # decrement  #halike

# it's all about the context
lambda i: 2*i-(sum(range(i))*2)/i # banermatt

# mapreducing  
lambda i: __import__('functools').partial(i.__add__, 1)()  #halike

# identity crisis
lambda i: i+(i is i) # SFJulie1 (kind of) #halike

# be real
lambda i: int((x-1j**2).real)  #halike

# TIMTOWTDI
lambda i: int(__import__("os").popen("perl -e'++($a=%d)&&print$a'"%i).read()) # SFJulie1

# Delegation aka someone may know the answer by SciK
lambda i: int(__import__("os").popen("perl -e'use Inline C=>q[int incr(int i){return i-~0^0;}];print incr %d'" % i).read())

# 
lambda i: int((lambda x: x('subprocess').check_output([x('sys').executable, '-c', 'print %d++1'%i])))(__import__)  #halike

# inchworm on a stick
lambda i:-~i # Brian

# regexp is a turing complete machine
lambda i: len(__import__('re').sub('(.)$', '\\1\\1', '1'*i)) #lost-theory (does not work on 0)

#tempis fugit
lambda i: i-(lambda t: int(t.time()-(t.sleep(1),t.time())[1]))(__import__('time'))

# being partial by willm
lambda i:__import__('itertools').dropwhile(lambda m:m==i, __import__('itertools').count(i)).next()

# pushing to the max 
lambda i: next(j for j in range(__import__('sys').maxint) if j > i) # nivertius

#might work by flowblok
lambda i: i+int(round(__import__('random').random()))

# the choice of a GNU generation by sonwell
lambda i: ((lambda rec, i, A, n: rec(rec, i, A, n))(lambda rec, i, A, n: A if i == 0 else i + abs(i - ((i > -1) - (i < 0)) * rec(rec, abs(i) - 1, A * n, n + 1) / abs(i)), i, 1, 2))

#nothing compares to U by cecedille1 (and sinnead O'connors)
lambda u:cmp(u,0) * len(xrange(-1 , i, cmp(u,0) ) ) if u else 1

# it's a kind of magic by ceceddile1
lambda i:(1).__radd__(i)

# the neighbour of the beast by fabzter & samus_
addition = lambda i: int((str(i)[:-1] + {'0': '1', '1': '2', '2': '3', '3': '4', '4': '5', '5': '6', '6': '7', '7': '8', '8': '9'}[str(i)[-1]] if str(i)[-1] in {'0': '1', '1': '2', '2': '3', '3': '4', '4': '5', '5': '6', '6': '7', '7': '8', '8': '9'} else str(addition(int(str(i)[:-1])) if str(i)[:-1] else '1') + '0') if str(i) else '1')

# cloud computing by hhh333
lambda n:float(__import__('re').findall("%d.?\d* \+ 1 = (\d+\.?\d*)"%n,__import__('requests').get("http://google.com/search", params=dict(q="%f+1"%n)).text)[0])

# In the face of ambiguity, refuse the temptation to guess. by gtr053
lambda x:float(raw_input("Pretty please enter the result of %f + 1: "%x))

# pseudomenon : defeats the truth swapping trick True,False=False,True
lambda x: x+(True if True else False)

# polyglot by Book mod SFJulie1 
q = 0 or """ #=;$A=41;sub A { ~-$A+2}; q' """
A=lambda A: -~A  #';
print A(41) # python + perl = <3

# se(ct|x)ually amibuous by Brian
lambda i: __import__('bisect').bisect(xrange(__import__('sys').maxint), i)

Are there even better way to do it?

EDIT: I will soon stop maintaining the page of the solutions.

Soz for pinpinbo solution that did not fit (polyglot is the «fait du prince») and brian core to the metal solution is nice, too.

I really thank everyone, because on one hand I never thought it would have a positive score, and on the other hand I never thought these kind of games were in fact non only fun, but also interesting: Brian & pinpinbo deserve a special mention on how easy it is to bind with C and fortran in python.

For the future I was thinking of hosting it somewhere on a blog ...

Find elsewhere
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › how to increment for loop in python
How to Increment For Loop in Python - Spark By {Examples}
May 31, 2024 - If we want to increment the counter value with the specified number we can go with the range() function. If you are in a hurry, below are some quick examples of custom incrementing for loop in Python.
🌐
AskPython
askpython.com › home › python increment operation
Python Increment Operation - AskPython
January 16, 2024 - The below code shows how almost all programmers increment integers or similar variables in Python. >>> a = 10 >>> print(a) 10 >>> a += 1 >>> print(a) 11 >>> a += 100 >>> print(a) 111
🌐
CodeGym
codegym.cc › java blog › learning python › increment and decrement in python
Increment and Decrement in Python
November 11, 2024 - The += operator is the most common way to increment a variable in Python. This method is both simple and efficient. counter = 0 counter += 1 print(counter) # Output: 1
🌐
Thinglabs
thinglabs.io › python-increment-by-1-a-guide-to-simple-counting-in-code
Python Increment by 1: A Guide to Simple Counting in Code - thinglabs
November 7, 2024 - Python does not have built-in increment or decrement operators (++ and --). The most common way to increment a variable by 1 is using the assignment operator (+=).
🌐
Python Guides
pythonguides.com › python-increment-by-1
Python Increment and Decrement by 1 - Python Guides
September 6, 2025 - Python Increments by 1 means increasing the value by a specific amount.
🌐
Scaler
scaler.com › home › topics › increment and decrement operators in python
Increment and Decrement Operators in Python - Scaler Topics
March 12, 2024 - In Python, the +=1 syntax neatly increments numerical variables, speeding your routines. This straightforward technique improves readability by making your code more expressive ...
🌐
Script Everything
scripteverything.com › posts › python increment by 1
Python Increment By 1 | Script Everything
December 10, 2022 - Does i++ work in Python? No, it doesn’t. It will return a SyntaxError. Therefore, to achieve the same purpose of incrementing a variable, i, by 1 using the syntax i += 1 or its longer form syntactical representation i = i + 1.
🌐
Reeborg
reeborg.ca › docs › en › variables › increment.html
6. Increment — Learn Python with Reeborg
Then, each time that Reeborg takes a step, I will add 1 to the previous value of number_of_steps. ... Before I write a Python program to do just that, let’s do an experiment. ... In computer programming, the action of changing the value of a variable so that it increases is called incrementing a ...
🌐
CodeSpeedy
codespeedy.com › home › increment number by 1 in python
Increment number by 1 in Python - CodeSpeedy
October 6, 2021 - If you are used to programming in languages like C++ and Java, you will be acquainted with using the increment operator (++) to increment the value of a number by 1. However, you should now know that the increment operator does not exist for Python.
🌐
Medium
harish303.medium.com › python-increment-operator-beginner-step-by-step-guide-a2205adceb29
Python Increment Operator: Beginner Step by Step Guide | by Harish Anbalagan | Medium
March 10, 2025 - Watch the YouTube tutorial · Let’s first see how to increase a variable’s value manually, without using +=. count = 1 # Initializing count with 1 count = count + 2 # Adding 2 to count print(count) # Output: 3 · We initialize count with ...
🌐
TutorialsPoint
tutorialspoint.com › increment-and-decrement-operators-in-python
Increment and Decrement Operators in Python?
August 23, 2023 - However, be careful if you are ... immutable. ... So what above statement means in python is: create an object of type int having value 1 and give the name a to it....
🌐
Flexiple
flexiple.com › python › python-increment
Python Increment - Everything you need to know | Flexiple Tutorial | Python - Flexiple
Thereby increasing readability by allowing the user to write the logic under the ‘if’ statement. This can be done using a = a +1, but Python supports a += 1 as well. a = 1 a += 2 print(a) #Output - 3<br> The above code shows how to increment ...