0Pricing
Coding for Kids · Lesson

Asking the User

Read a temperature.

Asking the User is a free Coding for Kids lesson on CoddyKit — lesson 3 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.

Talk to the User! 💬

Hi coder! 👋 So far WE picked the temperature. But what if we want the user to type their own number? 🤔

Python has a magic word for that: input()! ⌨️

print("Let's ask the user a question! 💬")

Meet input() ⌨️

input() stops the program and waits for someone to type something. ⏳

Then it gives us back whatever they typed! Let's try a name first. 😊

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

Asking for a Temperature 🌡️

Now let's ask for a temperature instead of a name! 🌡️

We write a friendly question inside the parentheses.

temp = input("Type a temperature in Celsius: ")
print("You typed:", temp)

Uh Oh, It's Text! 😅

Surprise! 😮 input() always gives us text (called a string), even if you typed numbers!

You can't do math with text... we need to fix that! 🔧

temp = input("Type a number: ")
print("This is text:", temp)
print("Type is:", type(temp))

Turning Text into a Number 🔢

We use float() to turn text into a number with decimals. ✨

Now Python knows it is a real number we can do math with! 🧮

text = input("Type a temperature: ")
number = float(text)
print("Now it is a number:", number)

All in One Line ➡️

Smart coders combine the steps! 🤓

We wrap input() inside float() to ask AND convert at the same time. 🎯

temp = float(input("Celsius please: "))
print("Got the number", temp, "🌡️")

int() for Whole Numbers 🔢

If you only want whole numbers (no decimals), use int() instead! 🍎

For temperatures, float() is usually better because of decimals. 🌡️

age = int(input("How old are you? "))
print("Next year you will be", age + 1, "🎂")

Do Math with Input 🧮

Now that it's a real number, let's add 10 to it! Easy! 🎉

temp = float(input("A temperature: "))
print("Add 10:", temp + 10)

Convert What They Typed 🪄

Let's put it together: ask for Celsius, then use our formula to get Fahrenheit! 🔥

c = float(input("Celsius: "))
f = c * 9 / 5 + 32
print(c, "C is", f, "F 🔥")

Friendly Questions 😊

Always write a friendly question so the user knows what to type! 🤗

A clear question makes a happy user! Add an emoji for extra fun! 🎈

c = float(input("How warm is it in Celsius today? 🌞 "))
print("Thanks! You said", c, "degrees!")

Input Expert! 🏆

You can now ask the user anything! 🎉

  • input() waits for typing ⌨️
  • It gives back text 📝
  • float() turns text into a number 🔢

Next we will show off a beautiful result! ✨

print("I can ask the user anything now! 🥳")

Quick Check ✅

Let's check what you learned! 🧠

Recap Time! 🎒

Awesome, you learned to talk to the user! 🌟

  • input() asks and waits ⏳
  • It returns text 📝
  • float() = numbers with decimals 🌡️
  • int() = whole numbers 🍎
  • float(input(...)) does both at once! ⚡

Next: show the result in a fancy way! ✨

print("Asking the user: complete! 🚀")

Frequently asked questions

Is the “Asking the User” lesson free?

Yes — the full text of “Asking the User” 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 “Asking the User”?

Read a temperature. 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 3 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Asking the User” 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. Celsius and Fahrenheit
  2. The Formula
  3. Asking the User
  4. Showing the Result
← Back to Coding for Kids