MCPcopy Create free account
hub / github.com/ndleah/python-mini-project / errorHandle

Function errorHandle

Math_Game/math_game.py:4–15  ·  view source on GitHub ↗
(problem_answer)

Source from the content-addressed store, hash-verified

2import operator
3
4def errorHandle(problem_answer):
5 switch = False
6 validated_guess = 0.0
7 while switch == False:
8 try:
9 validated_guess = float(input('Please enter a valid answer: '))
10 if type(validated_guess) is float:
11 switch = True
12 break
13 except ValueError:
14 pass
15 return validated_guess
16
17def random_problem():
18 operators = {

Callers 1

ask_questionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected