Write a python function to determine if a person is old enough to drive. To be old enough to drive the person must be at least 17
I have these two practice problems? I know they are easy but I just haven't gotten enough practice. I need to prepare for this quiz coming up and don't have a ton of solved examples from the professor to study from.
Write a Python function to determine if a person is old enough to drive. To be old
enough to drive, the person must be at least 17 years old. The function should
return a message to the program that invoked it. The message will state whether
the person is or is not old enough.
Write the program that asks the user to input the age of the applicant in years and then calls the function that will decide if the applicant is old enough to drive. The program will then print the message.
Your task is to write 2 functions and a Python program. One of your functions
is called “position” and one is called “awards”. Your program code will ask the race administrator to input num, the number of
racers. Your program will use a for loop in order to process each racer. It will ask the administrator to enter the name of the racer. The program will then invoke the awards function and pass to it the function named
“position” along with the number of racers. For example, the program might invoke
the awards function with this statement: feedback = awards (position(num)) The position function’s job is to prompt the judge to enter the finish position of the racer. The function then determines if the finish position is valid. To be valid, the position needs to be between 1 and num, where num is the number of racers. If the finish position entered is valid, the function will return its value to the awards
function. If the finish position is not a valid number, the function prompts the user
to enter a valid number. As part of the validity test, you could embed the following sentence in a while loop:
finishposition = int (input (str(num) + " is the highest possible finish position
and 1 the lowest, Enter valid finish position: ")) The awards function’s job is to translate the valid finish position into a message and then return that message to your program. It returns “Congratulations, you won Gold” if the racer came in first. “Congratulations, you won Silver” if the racer came
in second, and “Congratulations, you have won Bronze” if the racer came in third.
For all other finish positions, it returns “Thank you for helping to raise money for this worthy cause.” Your program then prints the name of the racer and the message it received from
the awards function