▶ Try it freePython Basics · Chapter 2 · input() and type conversion

Predict the output, then run it

x = "7"
y = "3"
print(x + y)

What does this program print?

This should add 3 and 4. Why does it print 34?

Code (you can edit this)
Typed input
Press ▶ Run to see what happens.

Runs on a mini Python built for this demo, right in your browser. The full course runs real Python 3.

Your turn: add two numbers

Read two whole numbers with input() and print their sum like this: Sum: 7

Liked this? Start the full course free

17 chapters from your first print() to a capstone project, with code you can run and exercises that check themselves.

  • Predict-the-output checks on every page
  • Auto-checked coding exercises with hints
  • Mocks and final: score 70% to pass · certificate on completion
Start the full course free