Command Palette

Search for a command to run...

Hectal
Phase 1: Values, Variables and Types
Python · Exercise 2 of 6 PreviousNext
Beginner

Add numbers that arrived as text

A form gave you two numbers as text: typed_a = "12" and typed_b = "30.5". Make a variable total that holds their sum as a number.

Then print Sum: 42.5 using total. Leave typed_a and typed_b as they are.

What Check tests

  1. total equals 42.5
  2. total is a float, not text
  3. typed_a and typed_b are still text
  4. The sum is calculated, not typed
  5. The program prints Sum: 42.5

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

main.py
Sign in to run your code.

Output

Press Run to see what your program prints.