Question: 1. The following program demonstrates the use of format() function to format a string. Please rewrite program by using 'f-string' method to generate the
1. The following program demonstrates the use of format() function to format a string. Please rewrite program by using 'f-string' method to generate the same outputs. (2* 4points) [1] stri= 'The area of (01s) is (11,d) square miles str2 = 'The population of (018) is (11.21) of the U.S. population state Florida area 65758 population 21780000 total 331900000 [2] print(stri.format(state, area)) print (str2.format(state, population/total)) The area of Florida is 65,758 square miles The population of Florida is 6.56% of the U.S. population 2. Write a function meal_total() that calculates the total amount of a meal purchased at a restaurant. The function should ask the user to enter their name, the charge for the food, what percent tip, and 7 percent sales tax. Display each of these amounts and the final total amount along with the user name when calling the function. (8 points) 3. Write a function generateLogin(first, last, zipc) that takes 3 parameters first, last and zipc. The function generates and returns a login name for a user given their firstname, lastname, and zipcode such that it has every other character of their first, last, and zipcode in the respective order and returns this login name all in uppercase. (function 6 points & formatting 6 points). Here is an example, use input() to serve varying end users' information. Input o Firstname: Mingyan o Lastname: Xu o Zipcode: 33602 Output Generated login: MNYNX362
Step by Step Solution
3.52 Rating (149 Votes )
There are 3 Steps involved in it
Answer 1 Using fstrings for string formatting state Florida area 65758 population 21780000 total 331... View full answer
Get step-by-step solutions from verified subject matter experts
