---
title: "Input, Output and Type Conversion"
description: "Reading what a user types, printing results back, and converting typed text into a number before doing arithmetic with it."
canonical: https://lightmysky.com/learn/computing/input-output-and-type-conversion-mt_lZmkGSELbC
source: https://lightmysky.com/learn/computing/input-output-and-type-conversion-mt_lZmkGSELbC.md
retrieved: 2026-09-12
---

> **Agent view.** This is the Markdown twin of the page, for tools and assistants.
> When to use this site, and the call that answers each job: https://lightmysky.com/agent-instructions.md
> API description (OpenAPI 3.1): https://lightmysky.com/openapi.json · Authentication: https://lightmysky.com/auth.md
> Pricing: https://lightmysky.com/pricing.md · Catalog: https://lightmysky.com/llms.txt · Full catalog: https://lightmysky.com/llms-full.txt
> Every machine-readable file on this domain: https://lightmysky.com/.well-known/ai-catalog.json
> Ask for Markdown with `Accept: text/markdown`, a `.md` address, or `?mode=agent`.

# Input, Output and Type Conversion

Reading what a user types, printing results back, and converting typed text into a number before doing arithmetic with it.

Subject: Computing · Area: Programming · Ages 14 to 15
Page: https://lightmysky.com/learn/computing/input-output-and-type-conversion-mt_lZmkGSELbC

## Ready when they can

- Read a value from the user and store it in a variable
- Convert typed input to a whole number or a decimal before calculating with it
- Explain why adding two typed numbers without converting them joins them as text

## Lesson: Ask, convert, print

Your program can ask the user to type something with input(), and show things back with print(). Whatever is typed always arrives as text, even when it looks like a number. You store it in a variable so you can use it later.

**Example.** A shop program needs a quantity and a price. It runs quantity = int(input()) and price = float(input()), then total = quantity * price, then print(total). With 3 and 5.0 typed in, it prints 15.0.

Use int() to turn typed text into a whole number, and float() for a decimal like a price. Mixing a whole number with a decimal gives a decimal, and dividing with / always gives a decimal too.

**Tip.** Never skip the conversion step. Adding two typed values without converting glues them as text, so 3 and 5 become 35 instead of 8.

**Recap.** Read text with input(), convert with int() or float(), then calculate and print.

## Practice

8 questions on this page, each with its working shown.

## Needs first

- [Variables and Assignment in Text Code](https://lightmysky.com/learn/computing/variables-and-assignment-in-text-code-mt_uLHLaX8BQq)

## Opens up

- [Arithmetic in Code: Integer Division and Remainder](https://lightmysky.com/learn/computing/arithmetic-in-code-integer-division-and-remainder-mt_ZPnPrLGPmT)
