Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4 . Write a program for a driving school. Your program will enter the details of many students, and then print out all the details

4. Write a program for a driving school. Your program will enter the details of many students, and then print out all the details using Python.
Input
In real life, you might use a form for entering data, but for the sake of this exam question, please use the input() function.
For each student record, the user of your software needs to enter the following fields in order:
permit_number: the student's/learner's permit number issued by the state.
first_name: the given name of a driving student of the school.
last_name: the surname of a driving student of the school.
date_of_birth: the date of birth of the student.
Input is terminated using a permit_number of "END".
Validation as part of the Input
You will need to validate the following fields:
the learner's permit number needs to be valid. See is_good_permitnum() below. The permit number must be a nine-digit number. The first digit must be 0.
the given name and surname must not be empty strings.
the date of birth needs to be a valid date. We assume the user will enter the date of birth as a single string according to the format: year-month-day. e.g."1965-11-23","1988-1-3". Please leave this date as a string. Do not convert it to a date object. See is_good_date() and requirements below. You should validate:
year>1960
1<= month <=12
1<= day <= days_in_month
days_in_month =30 if the month is 4,6,9 or 11
days_in_month =31 if the month is 1,3,5,7,8,10 or 12
days_in_month =28 if the month is 2(Leap year is not considered in the question)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions