← Python from Scratch Lesson 9 of 78 · 5 XP

Warm-up: double the number warm-up

Theory and problem statement

Machine translation, not yet reviewed by a native speaker.

input() always returns a string. To do maths, turn the string into a number with int():

n = int(input())   # you typed 5 — n holds the number 5
print(n + 1)       # 6

Multiplication is written with an asterisk: n * 2.

Task. Read an integer and print it multiplied by 2.

Sign up for free to solve this task right in your browser: code editor, running, test checks and hints.