Post

PythonPython

v
victoria mamidi

Posted on 24th April 2024|47 views

0
votes

Python Print Percentage

How can I print a percentage value in python?

print str(float(⅙))+% which is showing 0.0% when the actual answer is 16.66% what can I do?

 

Answers
P
Surya kumar

Posted on 24th April 2024

'{:.1%}'.format(1/6.0)

Output:

‘16.66%’

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos