Learn to Code via Tutorials on Repl.it!

← Back to all posts
How to use Round Function
kp2009 (1)

We will first need some numbers, and we will get these numbers from the user.

a=float(input("Enter any decimal number here:"))

What this does is basically ask the user to enter a float type number that they want to round. The number that they have entered will be given the variable name "a".

print("\n")

The backslash n leaves a space between the input and the answer.

print(round(a))

This uses the "round" function to round the variable "a" which is the number that the user has entered.