Answers for "how to get percentage in python"

0

how to get percentage in python

def percentage(part, whole):
  return 100 * float(part)/float(whole)

print(percentage(5, 7))
# If you want to limit the number of decimal to 2, change the number in {:.2f} as you wish;
print('{:.2f}'.format(percentage(5, 7)))
Posted by: Guest on July-29-2021
0

python convert to percentage

your_value = 1/3.0
print('{:.1%}'.format(your_value)) # Change the "1" to however many decimal places you need
# Result:
# '33.3%'
Posted by: Guest on May-26-2021
0

how to get percentage in python

quotient = 1000000 / 10
Posted by: Guest on August-13-2021

Code answers related to "how to get percentage in python"

Python Answers by Framework

Browse Popular Code Answers by Language