Exercise #1: Temperature converter ** Write a Python script that prompts a user for a temperature and then convert it from Celcius to Fahrenheit or Fahrenheit to Celcius. Example: 18 Convert to (C) or (F): F 64.4 ** More advanced: If the user supplies the letter C or F after the temperature, automatically convert to the other. Also, validate the entry to ensure it's a number followed by 'c' or 'f'. Example: Enter the temperature (e.g. 18C for Celcius/ 74F for Fahrenheit): 29C is equal to 84.2 degrees Fahenheit ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Exercise #2: Number guessing The following assigns a random integer to a variable: import random rand_num = random.randint(1,10) The two values in parenthesis inclusively represent the lowest and highest values to choose within. ** Write a Python script that prompts a user to guess the random number. Give the user three tries to get answer. If unsuccessful after the third attempt, report the random number. Example: Enter a number between 1 and 10: 5 Enter a number between 1 and 10: 8 Enter a number between 1 and 10: 6 The number was 7 ** More advanced: Help the user by supplying clues (higher/lower, hot/cold, etc) after each of the first two guesses. Example: Enter a number between 1 and 10: 5 Try a higher number. Enter a number between 1 and 10: 8 Try a lower number. Enter a number between 1 and 10: 6 Correct on try #3! Congratulations! Clue: When writing the script, output the random number with each guess to help determine if it is correctly reacting to the answers supplied. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Exercise #3: Day of week determiner The following converts a date e.g. '2021-04-29' from a string to a date format from datetime import datetime date_conv = (datetime.strptime('2021-04-29', '%Y-%m-%d')) ** Using this, prompt a user for a date and convert the entered string into the date format. Using that, tell the user the weekday (Monday, Tuesday, etc) of the date. Example: Enter date (YYYY-MM-DD): 2019-10-01 That day is a Tuesday. ** More advanced: Ensure the date entered is in a valid format and reprompt if incorrect. Example: Enter date (YYYY-MM-DD): 201-002-333 Enter date (YYYY-MM-DD): 2010-02-30 Enter date (YYYY-MM-DD): 2010-02-14 That day is a Sunday. Clue: The date can be in any format as long as the conversion matches the date entered. For example date_conv = (datetime.strptime('4/29/2021', '%m/%d/%Y')). Also, while not every function requires arguments, you still need to include the parentheses at the end. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Exercise #4: Address book ** Create an address book using a dictionary. Include the following data: name, telephone number and email address. Allow a user to specify which field they are searching, and retreive the matching entry. Example: Enter key: (F)irst Name, (L)ast Name, (E)mail: l Enter search term: holmes Name: Sherlock Holmes Phone: +44 20 0000 0221 Email: sholmes@syard.gov ** More advanced: Allow user to add and remove entries to the address book. Example: Select an option (L)ist, (S)earch, (A)dd, (R)emove, (Q)uit: Line # First Name Last Name Email Address 1 Elizabeth Bennet elizabeth_darcy@countryestates.org 2 Katniss Everdeen mockingjay@hgames.com 3 Jay Gatsby jgatsby@illicitwealth.com 4 Sherlock Holmes sholmes@syard.gov 5 Lisbeth Salander wasp@dragon_tattoo.net.se 6 Sam Spade mfalcon@privateeye.com Select an option (L)ist, (S)earch, (A)dd, (R)emove, (Q)uit: s Enter key: (F)irst Name, (L)ast Name, (E)mail: f Enter search term: Jay Name: Jay Gatsby Phone: 516-223-0882 Email: jgatsby@illicitwealth.com Select an option (L)ist, (S)earch, (A)dd, (R)emove, (Q)uit: a Enter First Name: Hermione Enter Last Name: Granger Enter Phone: +44 08 9322 0190 Enter Email: hgranger@hogwarts.edu Select an option (L)ist, (S)earch, (A)dd, (R)emove, (Q)uit: r Line # First Name Last Name Email Address 1 Elizabeth Bennet elizabeth_darcy@countryestates.org 2 Katniss Everdeen mockingjay@hgames.com 3 Jay Gatsby jgatsby@illicitwealth.com 4 Hermione Granger hgranger@hogwarts.edu 5 Sherlock Holmes sholmes@syard.gov 6 Lisbeth Salander wasp@dragon_tattoo.net.se 7 Sam Spade mfalcon@privateeye.com Enter line number of entry to remove: 2 Katniss Everdeen removed Select an option (L)ist, (S)earch, (A)dd, (R)emove, (Q)uit: l Line # First Name Last Name Email Address 1 Elizabeth Bennet elizabeth_darcy@countryestates.org 2 Jay Gatsby jgatsby@illicitwealth.com 3 Hermione Granger hgranger@hogwarts.edu 4 Sherlock Holmes sholmes@syard.gov 5 Lisbeth Salander wasp@dragon_tattoo.net.se 6 Sam Spade mfalcon@privateeye.com Select an option (L)ist, (S)earch, (A)dd, (R)emove, (Q)uit: q Clue: You can start create the address book within the script to have some data to work with and then add and remove entries. However, each time you run the script it will refresh to the original content. If you want to retain the data outside of the script, you will need to output the data to an external file, but that is not a requirement of this exercise. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++