Skip to content
Sign upLog in
← Back to Community
How to use Round Function
Profile icon
kp2009

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.

Voters
Profile icon
SvalaAgnes
Profile icon
alexnevil
Profile icon
Barry1383
Profile icon
kp2009