TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Printing Values In Python
Sr Karthiga
Mar 05, 2020
6.1
k
0
2
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
In this blog, I will be explaining about printing the values in Python.
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
Next Recommended Reading
The Simplest Method To Download You Tube Videos Using Python - Pytube