C# Corner
Tech
News
Videos
Forums
Trainings
Books
Events
More
Interviews
Jobs
Live
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Printing Values In Python
WhatsApp
Sr Karthiga
5y
6.4
k
0
2
25
Blog
values.zip
Introduction
In this article, I will explain about printing the values in Python. In previous blogs, I have explained about the Simple Strings with insert and delete. Here, I am explaining how to add the values that print on the Run module.
Software requirement
Python 2.7.11
Simple program
print(
"%f"
%(4235-0.23))
print(
"%0.2f"
% (4235-0.23))
print(
"%0.f"
% (4235-0.23))
Explanation
First, the %f is used to find the decimal point in the number. Then, %0.2f is used for displaying the two digits after the decimal. Then, the %0.f is used for not displaying the decimal values.
Lets us see the difference
print(
"%f"
%(4235-0.23))
In this statement, it will show the decimal point and the floating numbers after the decimal.
output
print(
"%0.2f"
% (4235-0.23))
In this statement, it will display only two numbers after the decimal point.
Output
print(
"%0.f"
% (4235-0.23))
In this statement, it will display only the number, not the digits after the decimal point.
Output
Final Program
Final Output
People also reading
Membership not found