What you will learn
  • Explain values, names, and types in plain language.
  • Trace information from input to output.
  • Test one subsystem independently.
  • Recognize a common failure and respond safely.
  • Modify the example without changing several variables at once.

The central idea: values, names, and types

A value is a piece of data; a variable is a name that refers to a value; and a data type describes the operations that make sense for that value. input() returns text, so numeric input must be converted deliberately.

Treat the system as a chain of observable inputs, explicit processing, a decision, and an output. That makes the design easier to explain and gives you a place to test when something fails. A working result is not enough: record what input produced it and what evidence shows the result is correct.

Follow the information through the system

Read the diagram from left to right. Each arrow is a boundary where data, electrical signals, or commands move between parts. Test those boundaries separately before combining the whole system.

A distance program stores a learner's name as text and distance as a number. It converts the typed distance before doing arithmetic.

  • Use descriptive snake_case names.
  • Convert text only after checking what format is expected.
  • Keep numbers numeric until presentation.
Keyboard text → input() → conversion → variable → calculation → print()

A small working example

Run this example exactly as shown before modifying it. Predict the output first, compare that prediction with the real result, and change only one part at a time.

Python
name = input("Your name: ")
minutes_text = input("Minutes studied: ")
minutes = int(minutes_text)
print(f"{name} studied for {minutes} minutes.")

The raw input is stored separately, converted to an integer, and inserted into an f-string.

Expected result: For name Sam and 25, the program prints: Sam studied for 25 minutes.

Test before you trust the result

Start with a normal case, then test a boundary case and a failure case. For software, try empty, unexpected, and extreme inputs. For hardware, begin with wheels raised or actuators disconnected, keep a physical power switch within reach, and verify safe stopping behavior.

Write down the expected result before each test. If the observation differs, stop and find the first boundary where the expected signal disappeared. This method is slower than changing many things at once, but it produces evidence instead of guesses.

  • Test one input with a known value.
  • Observe the intermediate value before the final action.
  • Confirm a safe response when input is missing or invalid.
  • Repeat the same test to check consistency.

Important terms

Variable
A name bound to a value.
String
A sequence of text characters.
Integer
A whole number.
Float
A number that may contain a fractional part.
Type conversion
Creating a value of one type from another.

Mini project: practice values, names, and types

  1. Create variables for a project name and minutes studied.
  2. Print both values with labels.
  3. Ask the user for another number.
  4. Convert it with int().
  5. Print the combined total.

Common mistakes and debugging

  • Expecting input() to return a number.
  • Using unclear one-letter names.
  • Putting quotation marks around a variable name by accident.
  • Concatenating text and numbers without conversion or formatting.

Independent challenge

Build a bill splitter that asks for a total and number of people, then displays the amount per person rounded to two decimal places.

Check your understanding: 10 questions

  1. What is the main purpose of values, names, and types?

  2. What does “Variable” mean in this lesson?

  3. How is “String” used?

  4. Why should you test one boundary or subsystem at a time?

  5. What should the system do when an input is missing or invalid?

  6. In your own words, what does “Variable” mean?

  7. In your own words, what does “String” mean?

  8. In your own words, what does “Integer” mean?

  9. In your own words, what does “Float” mean?

  10. In your own words, what does “Type conversion” mean?

Quiz answers

Reveal all 10 answers after your attempt
  1. A value is a piece of data; a variable is a name that refers to a value; and a data type describes the operations that make sense for that value. input() returns text, so numeric input must be converted deliberately.
  2. A name bound to a value.
  3. A sequence of text characters.
  4. It reveals where the expected value or behavior first changes, so debugging is based on evidence.
  5. It should reject the input, report the problem, or move to a documented safe state instead of guessing.
  6. A name bound to a value.
  7. A sequence of text characters.
  8. A whole number.
  9. A number that may contain a fractional part.
  10. Creating a value of one type from another.

Summary

values, names, and types becomes manageable when you identify the input, processing, decision, output, and evidence of success. Build the smallest version, test it, then make one measured change.

Continue learning

Continue to the next lesson, which builds on this model with one additional capability.

Choose a connected learning path

Sources and further reading

Prepared 2026-10-02. Editorially completed for the course. Software examples are designed for current Python 3; verify board, operating-system, library, and hardware details against the linked primary documentation before a physical build.