Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Printing Values In Python
WhatsApp
Sr Karthiga
4y
6.2
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
Printing Values
Python
Up Next
Serialization And Deserialization (JSON) Using Python
Ebook Download
View all
Python Overview
Read by 710 people
Download Now!
Learn
View all
Membership not found