Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 

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

Step: 1

Answer 1 Using fstrings for string formatting state Florida area 65758 population 21780000 total 331... blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Systems analysis and design

Authors: kenneth e. kendall, julie e. kendall

8th Edition

135094909, 013608916X, 9780135094907, 978-0136089162

More Books

Students also viewed these Programming questions

Question

What is life cycle budgeting?

Answered: 1 week ago

Question

Define the term normalization.

Answered: 1 week ago