Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python plssssss help In rooo 1, you will implement the pretty peint_int function. The function has a single nuaber parameter that is expected to be

python
plssssss help image text in transcribed
image text in transcribed
image text in transcribed
In rooo 1, you will implement the pretty peint_int function. The function has a single nuaber parameter that is expected to be int. The output of the pretty_print_int function is the same number converted to str. with commas placed every three decimal places to assist a reader. For. example: pretty_print_int (1000)1,000 pretty_print_int (5)) pretty_print_int (547475874)547,475,874 pretty_print_int (84989)84,989 pretty_print_int (999)999 ' You are encouraged to validate your implementation by placing several calls to the pretty print int into the if _nam _ . . . -sin . block in task2.py as shown below: If _ nane_ * + main_. print(pretty_orint_int(1000)) print (pretty_print_int(5)) print (pretty_print_int (547475174)) print (pretty_print_int (84989)) print(pretty_peint_int (999)) The expected output of running the task.py file would then be: (p2-env) -/ppp-iteration-conditionals-strings s python taskz.py 1,000 5 547,475,874 84,989 999 The pretty_print_dollars Function In rooo 2, you will implement the pretty_print_dollars function. The function has a single number parameter that is expected to be int or float. The output of the pretty_print_dollars function is the same number converted to str nicely formatted as a dollar amount with two decimals for cents as shown below: You are encouraged to validate your implementation by placing several calls to the pretty orint_do1lars into the if _ name _ . . _ain _. block in task2.py as shown below: if _ name_ = main_ : print(pretty_print_dollars (1000.0)) print(pretty_print_dollars (5.99)) print(pretty_print_do1lars (547475874)) print(pretty_print_do1lars (84989)) print(pretty_print_dollars (999.50)) The make_field Function In rooo 3, you will implement the make field function. The function has the following two parameters: - content: A value (e.g., ste, int, float, etc.) to be embedded in the field. - length : An int identifying the length of the field. The function embeds the argument provided to the content parameter in str and returns that str. If the content string is at most length - 2 characters long (which it should ideally be), then the " I' str is simply appended to the end of the content and the "\%" ste with the appropria number of space characters is prepended to make the whole string's length (not counting the pipes) correspond to the Iength argument. If the content string is longer than length - 2 , its right-most characters are first removed until its length corresponds to length - 2 exactly. Then, the embedding procedure described earlier is applied. For example: make field (1000,7) I 1000 l make_field("year", 8) " year I" make field("world", 5) "I wor I' You are encouraged to validate your implementation by placing several calls to the make field into the if _ nane _ = . main - Block in task2.py as shown below

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago