round
- round
pi = 3.141592653589793
print(pi) # 3.141592653589793
print(round(pi, 10)) # 3.1415926536
print(round(pi, 5)) # 3.14159
print(round(pi, 2)) # 3.14
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
pi = 3.141592653589793
print(pi) # 3.141592653589793
print(round(pi, 10)) # 3.1415926536
print(round(pi, 5)) # 3.14159
print(round(pi, 2)) # 3.14