MCPcopy Create free account
hub / github.com/geekcomputers/Python / get_valid_side

Function get_valid_side

AREA OF TRIANGLE.py:1–10  ·  view source on GitHub ↗
(prompt:str)

Source from the content-addressed store, hash-verified

1def get_valid_side(prompt:str):
2 while True:
3 try:
4 value = float(input(prompt))
5 if value <=0:
6 print("Side must be positive")
7 continue
8 return value
9 except ValueError:
10 print("Invalid Input")
11
12
13a = get_valid_side("Enter side 1: ")

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected