++ and-cannot be used for increment / decrement in python

Well, as the title says, If you are programming in C # or Java I think you may use num ++ or num-.

Often for for and while loop conditions Specify num <= 10 etc. Is it like writing num ++ at the end of the executable statement?

Well, ++ or-is reducing or increasing by 1. Doing this with python throws an error

Simply because there are no increment or decrement operators It's simple to know If you rewrite it as num + = 1, it works normally I don't think it needs to be explained, but + = is It shortens the place where you have to write num = num + 1 It's a nice operator.

inc.py


num=0
while num<=10:
# YOUR CODE HERE #
   num+=1
   num-=1

Recommended Posts

++ and-cannot be used for increment / decrement in python
Functions that can be used in for statements
[Python] f strings should be used for embedding strings
Japanese can be used with Python in Docker environment
[Memorandum] Japanese keys cannot be used in python string.Template.substitute
list comprehension because operator.methodcaller cannot be used in python 2.5
Operators ++,-cannot be used in python (difference from php)
Can be used in competition pros! Python standard library
Python3> slice copy / slice notation> used in for statements, etc.
[Redash] Standard library cannot be used in python function
Search for strings in Python
Techniques for sorting in Python
About "for _ in range ():" in python
Scripts that can be used when using bottle in Python
Can be used with AtCoder! A collection of techniques for drawing short code in Python!
What is Python? What is it used for?
Check for external commands in python
8 Frequently Used Commands in Python Django
[Python] Basic knowledge used in AtCoder
Run unittests in Python (for beginners)
33 strings that should not be used as variable names in python
Investigating what could be used as a Markdown parser in Python
New features in Python 3.9 (1)-Union operators can be used in dictionary types
Python standard input summary that can be used in competition pro
I wrote a tri-tree that can be used for high-speed dictionary implementation in D language and Python.
I created a template for a Python project that can be used universally
Notes on nfc.ContactlessFrontend () for nfcpy in python
Inject is recommended for DDD in Python
Python increment
Tips for dealing with binaries in Python
[python] Frequently used techniques in machine learning
Summary of various for statements in Python
Type annotations for Python2 in stub files!
Mathematical optimization that can be used for free work with Python + PuLP
Template for writing batch scripts in python
Process multiple lists with for in Python
MongoDB for the first time in Python
Get a token for conoha in python
Sample for handling eml files in Python
Tkinter could not be imported in Python
AtCoder cheat sheet in python (for myself)
I searched for prime numbers in python
Notes for using python (pydev) in eclipse
Tips for making small tools in python
Use pathlib in Maya (Python 2.7) for upcoming Python 3.7
Switch the module to be loaded for each execution environment in Python
I made a familiar function that can be used in statistics with Python
CERTIFICATE_VERIFY_FAILED in Python 3.6, the official installer for macOS
Import-linter was useful for layered architecture in Python
Techniques often used in python short coding (Notepad)
Add quotation marks ">" for replying emails in Python3
Logging settings for daily log rotation in python
Tips for hitting the ATND API in Python
Display candlesticks for FX (forex) data in Python
Boost.NumPy Tutorial for Extending Python in C ++ (Practice)
Zero padding for dynamic variable values in Python
Try to calculate RPN in Python (for beginners)
Notes for implementing simple collaborative filtering in Python
Don't use readlines () in your Python for statement!
Summary of frequently used Python arrays (for myself)
Code often used in Python / Django apps [prefectures]