The idiomatic way would be to use list comprehension:
myList = [10,20,30,40,50,60,70,80,90]
myInt = 10
newList = [x / myInt for x in myList]
or, if you need to maintain the reference to the original list:
myList[:] = [x / myInt for x in myList]
More Related Contents:
- Why does append() always return None in Python? [duplicate]
- Convert all strings in a list to int
- Python list of dictionaries search
- Get unique values from a list in python [duplicate]
- How to print pandas DataFrame without index
- How to uninstall Anaconda completely from macOS
- How to capture multiple camera streams with OpenCV?
- Reversing ‘one-hot’ encoding in Pandas
- round() doesn’t seem to be rounding properly
- How to change dataframe column names in pyspark?
- Reduce left and right margins in matplotlib plot
- python: how to send mail with TO, CC and BCC?
- Difference between the built-in pow() and math.pow() for floats, in Python?
- How to import a Python module from a sibling folder?
- python: class override “is” behavior
- Multiprocessing working in Python but not in iPython
- How do you get all classes defined in a module but not imported?
- Fastest way to count number of occurrences in a Python list
- Importing modules in Python – best practice
- Pandas join issue: columns overlap but no suffix specified
- Pandas groupby to to_csv
- Extracting matches with the original case used in the pattern during a case insensitive search
- How to return a custom 404 Not Found page using FastAPI?
- How do I verify that a string only contains letters, numbers, underscores and dashes? [duplicate]
- inserting newlines in xml file generated via xml.etree.ElementTree in python
- How to find exit code or reason when atexit callback is called in Python?
- Running Scapy on Windows with Python 2.7
- How to connect broken lines in a binary image using Python/Opencv
- I want to let my Discord Bot send images/gifs
- How to fix ipykernel_launcher.py: error: unrecognized arguments in jupyter?