Watch on Instagram

Code Bytes · "Start Here: What Is Coding?" · Episode 4 · The big picture

Do you need math to code?

For most coding you don't need to be great at math. The computer does the arithmetic for you, so print(4 + 4 + 2) in Python prints 10. What you really need is logic (thinking in clear steps) and patience to find your mistakes; everyday apps mostly need adding, comparing and counting, while areas like 3D games and AI use more math you can learn later.

Posted · About a 1 minute watch, 3 minute read · Take the quiz

The computer does the arithmetic

A computer is a very fast, very accurate calculator. You don't work out the answer yourself; you write the sum, and the computer works it out.

In Python, you type print, then the sum in brackets:

``python print(4 + 4 + 2) ``

Run it, and out comes:

`` 10 ``

A sum like this takes the computer far less than a thousandth of a second.

What you really need: logic and patience

The skill that matters most is logic: thinking in clear steps. For example, a shopping app needs a rule like this one (written in plain English, not code):

  1. Is the cart empty?
  2. If yes, show a message.

Coding is mostly breaking a job into small, exact steps like these.

The other skill is patience. Your code won't work the first time, every time. Reading it carefully, line by line, to find the mistake is a normal part of coding for everyone, beginners and experts alike.

Everyday apps need school-level math

Most everyday apps and websites mostly need three things:

  • Adding: totals in a cart, a score in a game
  • Comparing: is this price higher than that one? (> means "greater than")
  • Counting: how many likes, how many items, how many tries left

That's school-level math, and the computer does the actual calculating.

Some areas use more

Some kinds of programming do use more advanced math:

  • 3D games and graphics use geometry (shapes, angles, positions in space).
  • Artificial intelligence uses statistics and probability.
  • Simulations, cryptography and data science use more too.

You don't need any of that to start. You can learn it later, when a project needs it.

Try it yourself

Open any free online Python editor (search "online Python"), or type python3 on a computer that has Python. Paste this and press run:

``python print(250 + 175) print(1000 - 1) print(9 > 4) ``

You should see:

`` 425 999 True ``

The first two lines add and subtract. The third line compares: Python checks whether 9 is greater than 4 and prints True. Try changing it to print(4 > 9) and see what it prints instead.

Good to know

  • The code is Python 3. Every snippet on this page was run, and the outputs shown are copied from that run.
  • "Without mistakes" is true for whole numbers like these. Decimals can show tiny rounding surprises: print(0.1 + 0.2) prints 0.30000000000000004. That comes from how computers store decimals, and Code Bytes covers it in a later episode.
  • "Most coding needs less math than you think" is a widely held view, not a measured statistic. Some jobs (graphics, simulations, machine learning, cryptography, data science) do use linear algebra, calculus and probability.
  • "Instantly" is loose: a sum like this takes far under a millisecond.
  • The cart example is plain-English logic, not real code. Real if statements come later in Code Bytes.

Answer to the comment question

**In Python, means times. What does print(3 4 + 1) print? 13.** Python follows the usual school order of operations: multiplication comes before addition. So it works out 3 4 first, which is 12, then adds 1 to get 13. Writing print((3 4) + 1) with brackets gives the same answer and makes the order easier to read.

Test your knowledge

Quick quiz: Do you need math to code?

4 multiple-choice questions. Pick one answer for each, then check how you did.

1Do you need to be great at math to start coding?
2What does print(4 + 4 + 2) print in Python?
3Which skill does the lesson say you really need?
4Which area uses more advanced math, such as geometry?

Sources

Video transcript

Do you need to be great at math to learn coding?

For most coding, no. The computer does the arithmetic for you, instantly and without mistakes.

In Python, we type print, and in brackets, four plus four plus two. Run it, and out comes ten.

What you really need is logic: thinking in clear steps, like if the cart is empty, show a message. And patience to find your mistakes.

Everyday apps and websites mostly need adding, comparing and counting. School-level stuff.

Some areas do use more. 3D games use geometry, and artificial intelligence uses statistics. You can learn that later, when you need it.

In Python, a star means times. So what does this print? Comment your answer below!

That's your byte.

More from "Start Here: What Is Coding?"

All "Start Here: What Is Coding?" lessons