🎓 EASYTUTORGUIDE · Complete Python Course

Very beginner → professional Python · 60 chapters · 900 topics

EasyTutorGuide

Chapter 10: Numbers and Mathematics

Complete Python lesson for very beginners. Technical words are explained in simple language, and every outline topic includes a practical example, expected output, steps, and practice.

Python CourseVery Beginner Friendly15 TopicsExamples + Output20 Q&A
Chapter 10 · 15 topics
100%

Chapter Overview

This Python tutorial chapter covers Numbers and Mathematics through 15 connected topics. Work through the examples in order, check the expected output, and complete the practice after each topic.

  • 10.1 Integers
  • 10.2 Floating-Point Arithmetic
  • 10.3 Complex Numbers
  • 10.4 Rounding
  • 10.5 Absolute Values
  • Plus 10 additional Python topics in this chapter.

10.1 Integers

Integers is part of Numbers and Mathematics. In simple language, it means a whole number such as 5 or -2.

It is one building block of numbers and mathematics and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.

Technical words in simple language: Integers (a whole number such as 5 or -2).

Python / Practical Example

import math
print(math.sqrt(81))

Expected Output

9.0

Step-by-Step Explanation

  1. Read the example from top to bottom.
  2. Identify the value, object, or operation related to this topic.
  3. Change one small input and predict the result before running it.
Practice: Re-type the example for “Integers”, change one safe input, predict the result before running it, and explain in one sentence why the result changed.

10.2 Floating-Point Arithmetic

Floating-Point Arithmetic is part of Numbers and Mathematics. In simple language, it means a number that can contain a decimal part.

It is one building block of numbers and mathematics and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.

Technical words in simple language: Floating-Point Arithmetic (a number that can contain a decimal part).

Python / Practical Example

a = 10
b = 3
print(a + b, a - b, a * b, a / b)

Expected Output

13 7 30 3.3333333333333335

Step-by-Step Explanation

  1. Create two numbers.
  2. Apply arithmetic operators.
  3. Notice that / produces a floating-point result.
Practice: Re-type the example for “Floating-Point Arithmetic”, change one safe input, predict the result before running it, and explain in one sentence why the result changed.

10.3 Complex Numbers

Complex Numbers is part of Numbers and Mathematics. In simple language, it means a Python idea used while learning numbers and mathematics.

It is one building block of numbers and mathematics and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.

Technical words in simple language: Complex Numbers (a Python idea used while learning numbers and mathematics).

Python / Practical Example

import math
print(math.sqrt(81))

Expected Output

9.0

Step-by-Step Explanation

  1. Read the example from top to bottom.
  2. Identify the value, object, or operation related to this topic.
  3. Change one small input and predict the result before running it.
Practice: Re-type the example for “Complex Numbers”, change one safe input, predict the result before running it, and explain in one sentence why the result changed.

10.4 Rounding

Rounding is part of Numbers and Mathematics. In simple language, it means a Python idea used while learning numbers and mathematics.

It is one building block of numbers and mathematics and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.

Technical words in simple language: Rounding (a Python idea used while learning numbers and mathematics).

Python / Practical Example

value = 3.14159
print(round(value, 2))

Expected Output

3.14

Step-by-Step Explanation

  1. Pass the number to round().
  2. The second argument requests two decimal places.
  3. The rounded value is returned.
Practice: Re-type the example for “Rounding”, change one safe input, predict the result before running it, and explain in one sentence why the result changed.

10.5 Absolute Values

Absolute Values is part of Numbers and Mathematics. In simple language, it means a Python idea used while learning numbers and mathematics.

It is one building block of numbers and mathematics and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.

Technical words in simple language: Absolute Values (a Python idea used while learning numbers and mathematics).

Python / Practical Example

print(abs(-12))

Expected Output

12

Step-by-Step Explanation

  1. abs() returns distance from zero.
  2. A negative input becomes positive magnitude.
  3. The result is numeric.
Practice: Re-type the example for “Absolute Values”, change one safe input, predict the result before running it, and explain in one sentence why the result changed.

10.6 Powers

Powers is part of Numbers and Mathematics. In simple language, it means a Python idea used while learning numbers and mathematics.

It is one building block of numbers and mathematics and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.

Technical words in simple language: Powers (a Python idea used while learning numbers and mathematics).

Python / Practical Example

print(2 ** 5)
print(pow(3, 2))

Expected Output

32
9

Step-by-Step Explanation

  1. ** raises a number to a power.
  2. pow() can express the same kind of operation.
  3. Both examples return integers.
Practice: Re-type the example for “Powers”, change one safe input, predict the result before running it, and explain in one sentence why the result changed.

10.7 Minimum and Maximum

Minimum and Maximum is part of Numbers and Mathematics. In simple language, it means a Python idea used while learning numbers and mathematics.

It is one building block of numbers and mathematics and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.

Technical words in simple language: Minimum and Maximum (a Python idea used while learning numbers and mathematics).

Python / Practical Example

values = [8, 2, 11, 5]
print(min(values))
print(max(values))

Expected Output

2
11

Step-by-Step Explanation

  1. min() finds the smallest item.
  2. max() finds the largest item.
  3. They work on compatible comparable values.
Practice: Re-type the example for “Minimum and Maximum”, change one safe input, predict the result before running it, and explain in one sentence why the result changed.

10.8 sum()

sum() is part of Numbers and Mathematics. In simple language, it means a Python idea used while learning numbers and mathematics.

It is one building block of numbers and mathematics and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.

Technical words in simple language: sum() (a Python idea used while learning numbers and mathematics).

Python / Practical Example

values = [2, 4, 6]
print(sum(values))

Expected Output

12

Step-by-Step Explanation

  1. Create numeric values.
  2. sum() adds the items.
  3. The total is returned.
Practice: Re-type the example for “sum()”, change one safe input, predict the result before running it, and explain in one sentence why the result changed.

10.9 Math Module

Math Module is part of Numbers and Mathematics. In simple language, it means a Python file that can provide reusable code.

It is one building block of numbers and mathematics and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.

Technical words in simple language: Math Module (a Python file that can provide reusable code).

Python / Practical Example

import math
print(math.sqrt(81))

Expected Output

9.0

Step-by-Step Explanation

  1. import makes a module available.
  2. Use module.name to access its contents.
  3. The standard-library math module provides sqrt().
Practice: Re-type the example for “Math Module”, change one safe input, predict the result before running it, and explain in one sentence why the result changed.

10.10 Constants

Constants is part of Numbers and Mathematics. In simple language, it means a value you intend not to change.

It is one building block of numbers and mathematics and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.

Technical words in simple language: Constants (a value you intend not to change).

Python / Practical Example

import math
print(math.sqrt(81))

Expected Output

9.0

Step-by-Step Explanation

  1. Read the example from top to bottom.
  2. Identify the value, object, or operation related to this topic.
  3. Change one small input and predict the result before running it.
Practice: Re-type the example for “Constants”, change one safe input, predict the result before running it, and explain in one sentence why the result changed.

10.11 Trigonometry

Trigonometry is part of Numbers and Mathematics. In simple language, it means a Python idea used while learning numbers and mathematics.

It is one building block of numbers and mathematics and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.

Technical words in simple language: Trigonometry (a Python idea used while learning numbers and mathematics).

Python / Practical Example

try:
    number = int("not-a-number")
except ValueError as error:
    print(type(error).__name__)

Expected Output

ValueError

Step-by-Step Explanation

  1. Put risky conversion inside try.
  2. Catch the specific ValueError you expect.
  3. Handle the problem without hiding unrelated errors.
Practice: Re-type the example for “Trigonometry”, change one safe input, predict the result before running it, and explain in one sentence why the result changed.

10.12 Logarithms

Logarithms is part of Numbers and Mathematics. In simple language, it means a Python idea used while learning numbers and mathematics.

It is one building block of numbers and mathematics and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.

Technical words in simple language: Logarithms (a Python idea used while learning numbers and mathematics).

Python / Practical Example

import math
print(math.sqrt(81))

Expected Output

9.0

Step-by-Step Explanation

  1. Read the example from top to bottom.
  2. Identify the value, object, or operation related to this topic.
  3. Change one small input and predict the result before running it.
Practice: Re-type the example for “Logarithms”, change one safe input, predict the result before running it, and explain in one sentence why the result changed.

10.13 Random Numbers

Random Numbers is part of Numbers and Mathematics. In simple language, it means a Python idea used while learning numbers and mathematics.

It is one building block of numbers and mathematics and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.

Technical words in simple language: Random Numbers (a Python idea used while learning numbers and mathematics).

Python / Practical Example

import random
rng = random.Random(7)
print(rng.randint(1, 6))

Expected Output

3

Step-by-Step Explanation

  1. Create a local random-number generator with a fixed seed for a repeatable lesson.
  2. randint(1, 6) chooses an integer in that inclusive range.
  3. Do not use ordinary random tools for passwords or security secrets.
Practice: Re-type the example for “Random Numbers”, change one safe input, predict the result before running it, and explain in one sentence why the result changed.

10.14 Decimal Arithmetic

Decimal Arithmetic is part of Numbers and Mathematics. In simple language, it means a Python idea used while learning numbers and mathematics.

It is one building block of numbers and mathematics and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.

Technical words in simple language: Decimal Arithmetic (a Python idea used while learning numbers and mathematics).

Python / Practical Example

a = 10
b = 3
print(a + b, a - b, a * b, a / b)

Expected Output

13 7 30 3.3333333333333335

Step-by-Step Explanation

  1. Create two numbers.
  2. Apply arithmetic operators.
  3. Notice that / produces a floating-point result.
Practice: Re-type the example for “Decimal Arithmetic”, change one safe input, predict the result before running it, and explain in one sentence why the result changed.

10.15 Fractions

Fractions is part of Numbers and Mathematics. In simple language, it means a Python idea used while learning numbers and mathematics.

It is one building block of numbers and mathematics and helps you write clearer, more predictable Python programs. For a very beginner, focus first on what goes in, what Python does, and what comes out; details become easier after you run a small example.

Technical words in simple language: Fractions (a Python idea used while learning numbers and mathematics).

Python / Practical Example

from fractions import Fraction
print(Fraction(1, 3) + Fraction(1, 6))

Expected Output

1/2

Step-by-Step Explanation

  1. Create exact rational numbers.
  2. Add the fractions.
  3. Python simplifies the result.
Practice: Re-type the example for “Fractions”, change one safe input, predict the result before running it, and explain in one sentence why the result changed.

Common Beginner Mistakes

  • Copying code without predicting what each line does.
  • Ignoring the first useful error message or traceback location.
  • Mixing tabs/spaces or changing indentation accidentally.
  • Using data of the wrong type for an operation.
  • Trying to learn many advanced variations before mastering one small working example.

Chapter Practice

  1. Choose three topics from this chapter and re-type their examples without copying and pasting.
  2. For each example, change one input and predict the output first.
  3. Explain five technical terms from this chapter in your own beginner-friendly words.
  4. Create one small program that combines at least two chapter topics.
  5. Keep notes about errors you made and what fixed them.

Mini Project / Challenge

Create a small Python exercise that combines at least three ideas from Numbers and Mathematics. Start with a tiny working version, test it, then improve it one step at a time.

  1. Choose three topics from this chapter.
  2. Write or adapt a small Python example using those topics.
  3. Predict the output before running the code.
  4. Test at least one different input.
  5. Write two sentences explaining what the program does and what you learned.

20 Questions & Answers

1. What is the main goal of Chapter 10?

The goal is to understand numbers and mathematics through small explanations, examples, and practice.

2. Should I memorize every command or method?

No. Understand the pattern, practice the common form, and learn how to read documentation when you need exact details.

3. Why are the examples small?

Small examples isolate one idea at a time, which makes errors easier to understand and fix.

4. What should I do when an example gives an error?

Read the last part of the traceback, check spelling and indentation, confirm the required package or file exists, and compare the input types with what the operation expects.

5. Why should I predict output before running code?

Prediction forces you to reason about the program instead of only copying it.

6. What should I remember about Integers?

Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.

7. What should I remember about Floating-Point Arithmetic?

Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.

8. What should I remember about Complex Numbers?

Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.

9. What should I remember about Rounding?

Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.

10. What should I remember about Absolute Values?

Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.

11. What should I remember about Powers?

Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.

12. What should I remember about Minimum and Maximum?

Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.

13. What should I remember about sum()?

Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.

14. What should I remember about Math Module?

Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.

15. What should I remember about Constants?

Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.

16. What should I remember about Trigonometry?

Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.

17. What should I remember about Logarithms?

Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.

18. What should I remember about Random Numbers?

Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.

19. What should I remember about Decimal Arithmetic?

Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.

20. What should I remember about Fractions?

Remember its beginner meaning, the problem it helps solve, the shape of a small example, and one common situation where it is appropriate.