What a Percent Is
"Percent" means "per hundred": 37% is 37 out of every 100, the fraction or the decimal 0.37. This lesson explains what percentages mean, why they are useful for comparing, how percentages above 100% and below 1% work, and how to print percentages in Python.
Per hundred
The symbol % stands for "out of 100". Picture a grid of 100 squares: 37% is 37 of the squares.
To use a percentage in a calculation, divide by 100: that turns it into an ordinary decimal (move the point two places left). To show a decimal as a percentage, multiply by 100. The Converting lesson does this in every direction.
| Percent | Fraction | Decimal | Meaning |
|---|---|---|---|
| 1% | 0.01 | one in a hundred | |
| 10% | 0.1 | one in ten | |
| 25% | 0.25 | a quarter | |
| 50% | 0.5 | half | |
| 75% | 0.75 | three quarters | |
| 100% | 1 | 1 | all of it |
| 150% | 1.5 | one and a half times |
Why percentages are handy
Percentages put different-sized groups on the same scale. Class A had 18 of 24 students pass; class B had 26 of 40. Which did better?
The raw counts (18 vs 26) point the wrong way; the percentages show that A did better. A percentage is a fraction with denominator 100, so comparing percentages is comparing fractions after converting them all to hundredths.
More than 100%, less than 1%
- Above 100% means more than the whole: if this year's sales are 130% of last year's, they are 1.3 times as big. A test score cannot exceed 100% of the marks, but growth, ratios and "times as much" can.
- Below 1% is common for small risks and rates: , or 3 in 1000. Some fields use per mille (‰, per thousand) or basis points (), which finance uses for interest-rate moves.
Percentages in Python
Python's format specifier % multiplies by 100 and adds the sign for you:
classes = {"A": (18, 24), "B": (26, 40), "C": (7, 9)}
for name, (passed, total) in classes.items():
share = passed / total
print(f"{name}: {passed}/{total} = {share:.4f} = {share:.1%}")
print(f"{0.003:.1%} {1.3:.0%} {1:.0%}")A: 18/24 = 0.7500 = 75.0%
B: 26/40 = 0.6500 = 65.0%
C: 7/9 = 0.7778 = 77.8%
0.3% 130% 100%
is , shown rounded to one place as 77.8%.
Percentages of a whole add up to 100%
If you split something into parts, the parts' percentages add up to 100%. Rounded percentages may not: three equal parts are 33.3% each, which adds up to 99.9%. Charts and reports handle this with the "largest remainder" trick, the same idea as splitting a bill:
from fractions import Fraction as F
votes = {"yes": 1, "no": 1, "abstain": 1}
total = sum(votes.values())
exact = {k: F(v, total) * 100 for k, v in votes.items()}
rounded = {k: int(p) for k, p in exact.items()} # floor first
missing = 100 - sum(rounded.values())
by_remainder = sorted(exact, key=lambda k: exact[k] - int(exact[k]), reverse=True)
for k in by_remainder[:missing]:
rounded[k] += 1
print("naive:", {k: round(float(p)) for k, p in exact.items()})
print("fixed:", rounded, "sum =", sum(rounded.values()))naive: {'yes': 33, 'no': 33, 'abstain': 33}
fixed: {'yes': 34, 'no': 33, 'abstain': 33} sum = 100
In software
- Progress indicators show as a percent. Clamp to 0–100% and avoid dividing by zero when total is 0.
- Dashboards and A/B tests report conversion rates as percentages; "a 2% conversion rate" means 2 sales per 100 visitors.
- CSS uses percentages of the parent's size (
width: 50%), and opacity or volume sliders often show 0–100%. - Test coverage, CPU usage, battery level: all percentages of a known whole.
Exercises
Exercise 1: Percent to decimal and fraction
Write 45% and 2.5% as decimals and as fractions in lowest terms.
Answer
; .
Solution
Exercise 2: Which is better?
Team X won 21 of 30 games, team Y won 27 of 40. Which has the higher win percentage?
Answer
Team X: 70% vs 67.5%.
Solution
Exercise 3: Basis points
An interest rate rises from 4.25% to 4.60%. How many basis points is that?
Answer
35 basis points
Solution
percentage points. One basis point is 0.01 percentage points, so .
Exercise 4: A safe progress bar
Write progress(done, total) that returns a string like "42%" (rounded to a whole percent), returns "0%" when total is 0, and never shows more than 100%. Test (21, 50), (0, 0), (7, 3), (2, 3).
Answer
42%, 0%, 100%, 67%
Solution
def progress(done, total):
if total == 0:
return "0%"
share = min(done / total, 1.0)
return f"{share:.0%}"
for args in [(21, 50), (0, 0), (7, 3), (2, 3)]:
print(args, progress(*args))(21, 50) 42%
(0, 0) 0%
(7, 3) 100%
(2, 3) 67%
, which rounds to 67%.
Test yourself
What is 8% as a decimal?
- 0.8
- 8.0
- 0.08
- 0.008
This month's users are 240% of last month's. That means…
- 240 more users
- 2.4 times as many users
- a 24% increase
- it is impossible
What does f"{0.256:.1%}" produce?
- 0.3%
- 25.6%
- 0.256%
- 26%