Answers for "python to get percentage value with symbol"

1

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

Code answers related to "python to get percentage value with symbol"

Python Answers by Framework

Browse Popular Code Answers by Language