In a file called LastnameFirstnameFINAL.py, using your first and last name, create a program with 5 functions + a main function to demonstrate different concepts.

For the first four functions, you are free to make the functions do whatever you like and add on any other elements you want, as long as 1) they are not similar to past assignments or examples, and 2) the functions adhere to the following guidelines:

  • function1:
    • Should be passed either an int or float
    • Use an if-elseif-else that somehow incorporates the int/float value
    • Returns a value
  • function 2:
    • Should have at least three parameters
    • Should use either the Math or the Random module
    • Returns a value
  • function3:
    • Should be passed at least two things
    • Should use a String method
    • Should do one of the following: use a loop, access the web, automate a task
  • function 4:
    • Should be passed a list or dictionary
    • Use at least 1 method on the list/dictionary
    • Print the list/dictionary with a for loop

function5 will be used to record data to a separate file

  • Will be passed at least two things
  • In a separate text file, record the user's name, how many times they accessed each of the 4 functions, and an optional note from the user

The last function will be the main function.

  • main:
    • Ask your user for their name, then say hello
    • Allow your user to press: 1, 2, or 3, or 4 in order to call one of the first 4 functions
    • Use a loop to continually allow your user to call any of the 4 functions
    • Keep track of how many times your user uses each of the 4 functions
    • Allow the user to quit the program by pressing 0
      • When the user chooses to quit the program, pass the user's name, the record of how many times they used each of the 4 functions, and an optional note from the user. Write out this data to a separate file, appending the record so it can record previous uses of the program. For example, the text file might read:
        USER: Nikki
        FUNCTION CALLS: function1: 1x
        function2: 3x
        function3: 1x
        function4: 2x
        NOTES: omg function4 was the best 5 out of 5 stars!

        USER: Bob
        FUNCTION CALLS: function1: 0x
        function2: 10x
        function3: 0x
        function4: 0x
        NOTES: this program sucks, i'd rather watch paint dry

        USER: Kilroy
        FUNCTION CALLS: function1: 1x
        function2: 1x
        function3: 1x
        function4: 1x
        NOTES: kilroy was here
    • Print a message if the user doesn't input a valid command (in other words, not 1-4 or 0 for the command choices, or if you tell them to type yes or no and they type something different)
  • Call main only once.
  • Do not create any extra functions aside from what's asked for in the instructions. Remember that when a function returns something, you must do something with it.
  • Please make sure your code is thoroughly commented and your output clearly explains to the user what is happening in your program.
  • All code in your program must be inside of a function definition, aside from import statements and calling main. Make sure your code is ready to respond in case your user does not follow your instructions - please test your code extensively.

Expected Output

>>>
=============== RESTART: ManuelNikkiFINAL.py ===============

Welcome to my program, what's your name? Nikki's Mom

Hi, Nikki's Mom!
I'll show you what I've learned this semester!


                     ,---.           ,---.
/ /"`..--"""--./,'"
_ _ / /
`./ / __ __ ,'
/ /_O)_(_O
| .-' ___ `-. |
.--| _/ |--.
,' | / / `.
/ `. `--^--' ,'
.-"""""-. `--.___.--' .-"""""-.
.-----------/ ------------------/ --------------.
| .--------- /----------------- /------------. |
| | `-`--`--' `--'--'-' | |
| | | |
| | NIKKI'S SUPER COOL FINAL ICS 110P PROGRAM | |
| | | |
| | Press 1 to get a movie recommendation | |
| | Press 2 to calculate the height of Diamond Head | |
| | Press 3 to set up a homework due date reminder | |
| | Press 4 to create a playlist of your favorite songs | |
| | | |
| | Press 0 to quit | |
| |_____________________________________________________________| |
|_________________________________________________________________|



Enter a command: 1
A movie recommendation? Sure thing!

I'll recommend a movie to you based on your personality!
What month were you born in? January
What's your favorite animal? penguin
Are you an introvert, extrovert, or inbetween? introvert
Which is your favorite season? (spring, summer, fall, winter) fall
Do you prefer sweet or salty snacks? salty

Got it! Okay, based on your answers, the movie I recommend to you is...
Everything Everywhere All at Once

Check it out! You'll love it! :)


Enter a command: 100
Uhh.. That's not a valid option. Try again!


Enter a command: 0


Quitting already? Okay, I'm going to record how many times you used each function.
Would you also like to leave a note? It can be comments, feedback, anything!
Please type yes or no: yes

Okay, please type the note you would like to write.
Press enter when you are finished:

Fireflies light up the night sky, taking my mind off the stresses of the day.

Okay, the following information will be saved:
USER: Nikki's Mom
FUNCTION CALLS: function1: 1x
function2: 0x
function3: 0x
function4: 0x
NOTES: Fireflies light up the night sky, taking my mind off the stresses of the day.

Saved to the following textfile: record.txt

Thanks, and hope you have a great day! :)
>>>
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.