Course: Intro to computer science - Python > Unit 2
Lesson 2: Compound boolean expressionsChallenge: Input validation
Instructions
Step 1
Validate the month
Amy’s site has a web form for collecting a user’s birthday, but she notices that some site visitors entered nonsense month numbers like 0 or 47. She wants to add input validation to her form, so she can display an informative error message if a user enters an impossible date.
Amy added validation for the day, but now wants to handle the month input.
- Wrap the month error in a conditional so that it only prints if the month is invalid.
Valid month
values must be between 1 and 12, where 1 represents January and 12 represents December. If the month is between 1 and 12, inclusive, the month error should not print.
Do not change the wording of the error messages.