LearnPy Hub
← Exceptions problems
Hard

Three Tries Only

Read lines one at a time, trying to get a whole number between 1 and 10. Print try N: invalid for each bad line. Stop when a valid number arrives (print got X) or after three bad tries (print giving up).

Input

Up to three lines.

Output

Lines.

Sample 1

Input
abc
5
Output
try 1: invalid
got 5

Sample 2

Input
7
Output
got 7
solution.py
Output appears here
Three Tries Only · Python practice problem · LearnPy Hub