Python beginner ~ Round off the Nth decimal place and output ~ (for memo)

(For memo)

Sample code

sample.py


num = 0.8571428571428571
print("{:.2}".format(num))

Output result

answer.py


0.86

Recommended Posts

Python beginner ~ Round off the Nth decimal place and output ~ (for memo)
Pandas of the beginner, by the beginner, for the beginner [Python]
python beginner memo (9.2-10)
python beginner memo (9.1)
A memo for creating a python environment by a beginner
Python beginner memo (2)
The simplest Python memo in Japan (classes and objects)
[Python] Measures and displays the time required for processing
[python] option to turn off the output of click.progressbar
[Python] Output battles and combinations (nesting for statements and if statements)
Recursively search for files and directories in Python and output
python memo (for myself): About the development environment virtualenv
python input and output
Check what the character code is for all files under the directory that is Python and output
Sort and output the elements in the list as elements and multiples in Python.
python memo: enumerate () -get index and element of list at the same time and turn for statement
A Python beginner first tried a quick and easy analysis of weather data for the last 10 years.
Python and ruby slice memo
Python code memo for yourself
Easy way to round off to the nearest whole number with python3
[Beginner memo] How to specify the library reading path in Python