0Pricing
Coding for Kids · Lesson

Getting Two Numbers

Read user input.

Getting Two Numbers is a free Coding for Kids lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Coding for Kids learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Let's Build a Calculator! 🧮

Hi inventor! 🛠️ We're going to build our very own calculator! 🧮

First step: we need to GET two numbers from the person using it. Let's learn how to ask!

print('Welcome to my calculator! 🧮')

The input() Helper 🗣️

The word input() lets the computer ASK a question and wait for an answer. 🗣️

Whatever the person types gets saved in a box (a variable)!

name = input('What is your name? ')
print('Hello,', name)

Words vs Numbers 🔤

Here's a tricky part! When someone types with input(), the computer thinks it's a WORD (text), not a number. 🔤

So '5' + '5' would become '55' instead of 10! Oops! 😅

a = input('Type 5: ')
b = input('Type 5: ')
print(a + b)

Turn Text Into Numbers 🔢

To fix that, we wrap input in int(). The word int means a whole number! 🔢

Now the computer treats the answer as a real number for math!

a = int(input('Type 5: '))
b = int(input('Type 5: '))
print(a + b)

Getting the First Number 1️⃣

Let's ask for the first number for our calculator. We'll call it num1. 1️⃣

num1 = int(input('Enter the first number: '))
print('You picked', num1)

Getting the Second Number 2️⃣

Now the second number, called num2! 2️⃣ Two numbers means we can do math with them!

num2 = int(input('Enter the second number: '))
print('You picked', num2)

Both Numbers Together 🤝

Let's ask for BOTH numbers, one after the other. The calculator is starting to take shape! 🤝

num1 = int(input('First number: '))
num2 = int(input('Second number: '))
print('Your numbers are', num1, 'and', num2)

Add Them Right Away ➕

Now that they are real numbers, let's add them! ➕ Watch the magic happen!

num1 = int(input('First number: '))
num2 = int(input('Second number: '))
print('Together they make', num1 + num2)

Decimals Too? 🌊

What if someone types 2.5? int() only likes whole numbers. For decimals, we use float() instead! 🌊

Float numbers can have a dot in them!

price = float(input('Enter a price like 2.5: '))
print('You typed', price)

Friendly Questions 😊

Always make your questions clear and friendly! Add a space at the end so the typing doesn't bump into your words. 😊

age = int(input('How old are you? '))
print('Wow,', age, 'is a great age! 🎂')

You Can Ask Anything! 🚀

Now you know how to get numbers from a user! Try changing the questions below. 🚀

This is the FIRST step of every calculator. Great start!

a = int(input('Pick a number: '))
b = int(input('Pick another: '))
print('Got them!', a, 'and', b)

Quick Check! 🧠

Let's test what you learned about getting numbers! 🔢

Step One Done! 🎉

Awesome! 🎉 You can get two numbers!

  • input() asks and waits 🗣️
  • It gives back TEXT, not numbers 🔤
  • int() turns text into whole numbers 🔢
  • float() is for decimals 🌊

Next: doing the actual math! ➕

num1 = int(input('First number: '))
num2 = int(input('Second number: '))
print('Ready to calculate with', num1, 'and', num2, '! 🧮')

Frequently asked questions

Is the “Getting Two Numbers” lesson free?

Yes — the full text of “Getting Two Numbers” is free to read here on the web, and the Coding for Kids course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Coding for Kids course, upgrade to CoddyKit PRO.

What will I learn in “Getting Two Numbers”?

Read user input. You practise Coding for Kids with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Coding for Kids?

No prior experience is required. Coding for Kids on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Getting Two Numbers” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Coding for Kids lesson?

Yes. Every Coding for Kids lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Getting Two Numbers
  2. Doing the Math
  3. Choosing an Operation
  4. Showing the Answer
← Back to Coding for Kids