← Python from Scratch
Lesson 48 of 78 · 5 XP
Warm-up: is it a number? warm-up
Theory and problem statement
Machine translation, not yet reviewed by a native speaker.
If you type something that is not a number, int() fails with a ValueError. You can "catch" the error: put the code you try in try, and what to do on error in except:
try:
n = int(input())
print(n * 10)
except ValueError:
print("Not a number")
Task. Read a line. If it is an integer, print it multiplied by 10. If not, print Not a number.
Sign up for free to solve this task right in your browser: code editor, running, test checks and hints.