LevelJar Sign in

Python course / Foundations

Values and variables

Write your first working programs: show a value, store one under a name, and move between text and numbers. Most early bugs are a number that is secretly text, and this is where you learn to tell them apart.

  • printing
  • strings
  • numbers
  • variables
  • types
  • f-strings
  • slicing
  • input()

Start this module

Runs in your browser. Start straight away; create an account when you want your progress kept.

text, numbers and the line between them
price = "3.50"
count = 4

total = float(price) * count
label = "tea"

print(f"{count} x {label}: {total:.2f}")
print(label.upper(), label[0], label[1:])
4 x tea: 14.00
TEA t ea

What you will learn

The lessons in this module

  • Printing output
  • Text values
  • Numbers and arithmetic
  • Variables
  • Changing a variable
  • Types
  • Converting between types
  • f-strings
  • String methods
  • Reaching into a string
  • Slicing
  • Reading input
  • Comments and layout
  • Module review: unit converter

Ready when you are

Start this module

Next: Conditions and branching. All modules are on the course page.