Decode School

Decode School - The School for Problem Solvers
Need Assignment / Project Guidance (or) Training in Python?

Python Decimal places

Python program to get a fractional number from user and display the same in two digit precision

Sample Input 1:


Sample Output 1:


Program or Solution

num=float(input("Enter a Number:"))


Program Explanation

In python format specifiers are mentioned inside {} and value for the specifiers are passed through the format() method.

Here :.2f specifies float value with 2 decimal point.