Python Numeric Types
Game time scenario
Imagine you’re in charge of updating the scoreboard at a football match. The system needs to track the goals (whole numbers), the average possession percentage (decimals), and whether the game is still active or finished. Not every number is the same!
Python organizes numbers into numeric types, which help the program understand how to work with them.
In this lesson, we’ll build a simplified scoreboard and learn the different numeric types in Python.
Below is a cheat sheet for this lesson, highlighting the key concepts and notes for quick revision.

You’re the programmer responsible for creating scoreboard system. Let’s understand the numeric types before we build it.
The core idea
Python has three main numeric types:
- Integer (int) – whole numbers without decimals.
Example: 10, -5, 2025 - Float (float) – numbers with decimal points.
Example: 7.5, 3.1416, 0.99 - Complex (complex) – numbers with a real and imaginary part (used in advanced math).
Example: 2 + 3j
Most beginner projects use int and float. Complex numbers are more common in scientific or engineering problems.
Example in code:
1 2 3goals = 3 # int possession = 62.5 # float score_formula = 2 + 3j # complex
Think of our football match:
- The number of goals must be a whole number (int).
- The percentage of ball possession is a decimal (float).
- If we were doing advanced physics modeling for the ball’s motion, we might use complex numbers (complex).
Choosing the right numeric type makes sure our calculations are accurate and logical.
✨ Quick facts
- int → whole numbers (5, -10, 2024)
- float → decimals (3.5, 0.01, -7.25)
- complex → real + imaginary (2+3j, 4-1j)
Try it out
Let’s make a simple football scoreboard:
1 2 3 4 5 6 7 8 9 10team_a_goals = 2 # int team_b_goals = 1 # int possession_a = 58.5 # float possession_b = 41.5 # float print("=== SCOREBOARD ===") print("Team A Goals:", team_a_goals) print("Team B Goals:", team_b_goals) print("Possession A:", possession_a, "%") print("Possession B:", possession_b, "%")
Output:
1 2 3 4 5=== SCOREBOARD === Team A Goals: 2 Team B Goals: 1 Possession A: 58.5 % Possession B: 41.5 %
Work with AI
If you’re using an AI assistant, try this:
Prompt:
Write a Python program that uses integers and floats to create a basketball scoreboard. Include points, fouls, and shooting accuracy (percentage). Print the results clearly.
The AI will generate the scoreboard program with the correct numeric types.
Practice challenge
Great progress! Let’s test your understanding with a new scenario.
Task
Create a scoreboard for a cricket match. Show:
- Team X runs: 245 (int)
- Team Y runs: 198 (int)
- Run rate: 5.75 (float)
- Target difference: 47 (int)
The output should look like this:
1 2 3 4 5=== CRICKET SCOREBOARD === Team X Runs: 245 Team Y Runs: 198 Run Rate: 5.75 Target Difference: 47
Solution
1 2 3 4 5 6 7 8 9 10team_x_runs = 245 team_y_runs = 198 run_rate = 5.75 target_difference = 47 print("=== CRICKET SCOREBOARD ===") print("Team X Runs:", team_x_runs) print("Team Y Runs:", team_y_runs) print("Run Rate:", run_rate) print("Target Difference:", target_difference)
Perfect! You’ve now mastered Python’s numeric types and how to use them in real-world projects.