Module 2 · Beginner · Numbers and arithmetic

Percentages explained, with examples

Percentages explained for beginners: what per cent means, converting fractions and decimals, and finding percentages of numbers, with Python examples.

By theprogrammers team · · 7 min read

"20% off." "18% GST." "Accuracy: 94%." "Only 3% of transactions are fraud." Percentages are the most common way to describe numbers in business, news and data science, because they make very different quantities easy to compare. 45 out of 300 and 120 out of 800 are hard to compare at a glance; 15% and 15% are obviously the same.

This lesson explains percentages from the ground up: what they mean, how they connect to fractions and decimals, and the three questions every percentage problem boils down to. Each method is shown step by step and checked with Python, with real examples from shopping, exams and data. Changes over time, like "sales grew 12%", have their own lesson: percentage change.

What you need first: fractions and decimals.

Key terms

  • Per cent (%): "out of 100". 35% means 35 out of every 100.
  • Proportion: a part compared with the whole, written as a fraction or decimal: 0.35.
  • Base (or whole): the total that a percentage is taken of: in "20% of 500", the base is 500.
  • Rate: here, another word for the percentage itself.

What "per cent" means

"Per cent" comes from Latin per centum: "for every hundred". 35% means 35 out of every 100, which is the fraction 35/100 and the decimal 0.35.

Picture a grid of 100 squares. 35% means 35 of them are coloured. 100% is the whole grid. 0% is none. And you can go beyond: 150% means one and a half grids.

Converting between percentages, decimals and fractions

To convertDo thisExample
Percentage → decimalDivide by 10035% → 0.35
Decimal → percentageMultiply by 1000.35 → 35%
Fraction → percentageDivide top by bottom, then × 100⅜ → 0.375 → 37.5%
Percentage → fractionPut over 100, then simplify35% → 35/100 → 7/20

Dividing by 100 moves the digits two places: 7% is 0.07, not 0.7. That's a very common slip.

Useful ones to know by heart:

PercentageDecimalFraction
1%0.011/100
5%0.051/20
10%0.11/10
20%0.21/5
25%0.251/4
33⅓%0.333…1/3
50%0.51/2
75%0.753/4
100%11

The three types of percentage question

Every basic percentage problem asks for one of three things. They all come from one relationship:

part = percentage × whole (with the percentage written as a decimal)

Type 1: find a percentage of a number

What is 18% of ₹2,500?

Convert the percentage to a decimal and multiply:

0.18 × 2,500 = ₹450

"Of" means multiply, just as with fractions.

A mental shortcut: find 10% by dividing by 10, then build from there. 10% of 2,500 is 250, so 20% is 500, 5% is 125, and 1% is 25. 18% = 20% − 2% = 500 − 50 = 450.

Type 2: what percentage is one number of another?

You scored 42 out of 60. What percentage is that?

Divide the part by the whole, then multiply by 100:

42 ÷ 60 = 0.7 → 70%

This is the most common calculation in data science: 45 churned customers out of 300 is 45 ÷ 300 = 0.15 = 15%.

Type 3: find the whole from a part

18 students got an A, which is 12% of the class. How many students are in the class?

The part (18) is 12% of the whole, so divide the part by the percentage:

18 ÷ 0.12 = 150 students

Check: 12% of 150 = 0.12 × 150 = 18. ✓

All three in Python

print(0.18 * 2500)             # 18% of 2,500
print(42 / 60 * 100)           # 42 out of 60 as a percentage
print(18 / 0.12)               # whole, when 18 is 12% of it
print(f"{45 / 300:.1%}")       # format a proportion as a percentage
450.0
70.0
150.0
15.0%

The f-string format .1% multiplies by 100 and adds the % sign for you, so in code you usually work with proportions like 0.15 and only show them as percentages at the end.

Everyday examples

Discounts

A ₹3,200 jacket has 25% off.

  • Discount: 0.25 × 3,200 = ₹800.
  • Sale price: 3,200 − 800 = ₹2,400.

Shortcut: paying 75% of the price, 0.75 × 3,200 = ₹2,400, gives the answer in one step.

Tax

A ₹1,500 meal plus 5% GST.

  • Tax: 0.05 × 1,500 = ₹75.
  • Total: ₹1,575, or in one step: 1.05 × 1,500 = 1,575.

Multiplying by 1.05 means "100% of the price plus 5%". This one-step idea is the key to percentage change.

Exam marks across different tests

Maths: 68 out of 80. Science: 85 out of 100. Which is better?

  • Maths: 68 ÷ 80 = 85%.
  • Science: 85 ÷ 100 = 85%.

Equally good. Percentages put different totals on the same scale, which is exactly why they're so useful.

Percentages in data science

Proportions of a column

In pandas, the mean of a True/False column is the proportion of True values:

import pandas as pd

orders = pd.DataFrame({"status": ["delivered", "returned", "delivered", "delivered",
                                  "cancelled", "delivered", "returned", "delivered"]})
print(orders["status"].value_counts(normalize=True))
print(f"Return rate: {(orders['status'] == 'returned').mean():.1%}")
status
delivered    0.625
returned     0.250
cancelled    0.125
Name: proportion, dtype: float64
Return rate: 25.0%

value_counts(normalize=True) gives each category's share of the rows: 5 of 8 orders, 62.5%, were delivered.

Model metrics

Accuracy, precision and recall are all percentages: correct predictions out of a total. An accuracy of 0.94 means 94% of predictions were right. Classification metrics explains them, and why a high percentage can still hide a bad model.

Missing data

df = pd.DataFrame({"age": [25, None, 31, None, 40], "city": ["Pune", "Delhi", None, "Goa", "Agra"]})
print((df.isna().mean() * 100).round(1))
age     40.0
city    20.0
dtype: float64

40% of ages are missing and 20% of cities. Checking this percentage is the first step of handling missing values.

Common mistakes

  • Forgetting to divide by 100: 7% is 0.07, not 0.7.
  • Using the wrong base: "20% of the class are left-handed" and "20% of left-handed students are in this class" are very different statements. Always ask "percentage of what?".
  • Adding percentages of different wholes: 10% of one group plus 20% of another is not 30% of the total unless the groups are the same size.
  • Percentages of tiny groups: "100% of customers in Goa churned" sounds dramatic, but if that's 1 out of 1 customer, it means nothing. Always report the count alongside the percentage.

Practice

  1. Convert: (a) 8% to a decimal (b) 0.625 to a percentage (c) 45% to a fraction in simplest form.
Show the answer

(a) 0.08 (b) 62.5% (c) 45/100 = 9/20

  1. What is 15% of ₹840?
Show the answer

0.15 × 840 = ₹126. Mentally: 10% is 84 and 5% is 42, so 15% is 126.

  1. 27 out of 450 emails were spam. What percentage is that?
Show the answer

27 ÷ 450 = 0.06, so 6%.

  1. A shop says ₹240 is 30% of the original price. What was the original price?
Show the answer

240 ÷ 0.30 = ₹800.

  1. A dataset has 2,000 rows; 3.5% have a missing email address. How many rows is that?
Show the answer

0.035 × 2,000 = 70 rows.

Key takeaways

  • Per cent means "out of 100": 35% = 35/100 = 0.35.
  • Divide by 100 to turn a percentage into a decimal; multiply by 100 to go back.
  • The three questions: percentage of a number (multiply), what percentage one is of another (divide, × 100), and the whole from a part (divide by the percentage).
  • In code, work with proportions like 0.15 and format them as percentages at the end.
  • Always ask "percentage of what?", and report counts alongside percentages.

Frequently asked questions

How do I calculate a percentage of a number?

Convert the percentage to a decimal by dividing by 100, then multiply. For example, 18% of 2,500 is 0.18 × 2,500 = 450.

How do I work out what percentage one number is of another?

Divide the part by the whole and multiply by 100. For example, 42 out of 60 is 42 ÷ 60 × 100 = 70%.

Can a percentage be more than 100%?

Yes, when the part is bigger than the base. A price that has doubled is 200% of its original value, and sales of 150 against a target of 100 are 150% of target.

What to learn next

  1. Measure growth and decline in percentage change: increase, decrease and growth.
  2. Revisit decimals, rounding and significant figures.