LearnPy Hub
← Exceptions problems
Medium

Average of the Good Values

Write average(tokens) that converts each token with float(), skipping ones that fail, and raises ValueError('no numbers') if none are left. Read tokens and print the average with 2 decimals or the error message.

Input

Tokens separated by spaces.

Output

One line.

Sample 1

Input
1 2 x 3
Output
2.00

Sample 2

Input
a b c
Output
no numbers
solution.py
Output appears here
Average of the Good Values · Python practice problem · LearnPy Hub