Loading...
Loading...
Loading...
A settings file has lines like timeout=30. The first line of input is the number m of lines. The next m lines are settings.
A line is valid when it has exactly one = and the part after it is a whole number. Print each valid setting as <key>: <number>, in order. After them print Skipped: <count> for the lines that were not valid.
Skipped: <count>.Example
Input
4 timeout=30 retries=x debug port=8080
Output
timeout: 30 port: 8080 Skipped: 2
Two valid lines, two skipped.
Try the problem first. Open one hint at a time.
Unpacking the result of split("=") into two names raises ValueError when the number of parts is not two.
int(value) raises ValueError too, so one except handles both problems. Count the skipped lines there.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor