Objective
Create a Python program that reads a text and converts it into an integer without the program crashing if it is not one.
Instructions
- Read a text with
input(). - Try to convert it to an integer with
int()inside atryblock. - If it works, show double the number.
- If it does not, catch
ValueErrorand showInvalid number.
21
42
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise