menu_book Course Curriculum (Intro to Programming) expand_more
Core Concepts
Data Structures
Problem Solving
Input validation
Learn Input validation in Intro to Programming with a focused explanation, a topic-specific example, and a mastery check.
12 min read
•
Intermediate
intro-programming-017.py
python
def parse_age(text):
value=int(text)
if not 0<=value<=130: raise ValueError('age out of range')
return value
print(parse_age('29'))
What to watch
Content source & attribution
Original Syntaxis Content · Original Syntaxis Content