Answers for "percentage showing in print python"

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
1

python print percent sign

print("%d %% done!" % 100)
// prints "100 % done!"
Posted by: Guest on April-23-2020

Code answers related to "percentage showing in print python"

Python Answers by Framework

Browse Popular Code Answers by Language