Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Stuck on this Python ASCII art program. Please help! Program Specifications Let's look back at PA01-W2 ASCII Art where you printed a tree and a

Stuck on this Python ASCII art program. Please help!

image text in transcribedimage text in transcribed

Program Specifications Let's look back at PA01-W2 ASCII Art where you printed a tree and a rabbit. Let's now print multiple trees and rabbits: three rabbits with two trees between the rabbits. Of course, you don't want to repeat ourselves. Hence, you should use functions to decompose your program such that none of your print statements are duplicates, with the exception of the print statements in the tree that prints three * characters and print statements that print an empty line. You are required to write one function to print the tree and a separate function to print the rabbit. Your program should produce the output as shown below in the sample run. Sample run There is an empty line after the end of each drawing. This is also the case for the last rabbit. However, the sample run does not show the empty line after it. ( ( (-.-) o_(") (") * * *** ** (11 (-.-) o_(") (") (-:-) O_(") (") Required program decomposition print_tree(): this function should print the tree part of the ASCII art. Include an empty line at the end of the art. Printing an empty line is simply calling the print function without any arguments. The expected output of calling print_tree is the following, where the empty line at the end is not shown. ** * print_rabbit(): this function should print the rabbit part of the ASCII art. Include an empty line at the end of the art. The expected output of calling print_tree isthe following, where the empty line at the end is not shown. (-:-) o_(") (") Notes You must make the calls to the two functions above in the main function. As described in class, in the template that we will use, the main function is the function that will be called when the program starts executing. The two lines of code starting with if name == ' main ': tells Python to execute the main function when the program starts. This code is also necessary when we're dealing with modules, which we haven't covered yet. All your statements must be part of the print_tree or print_rabbit functions, or part of the main function. Points will be deducted if a statement is not part of any of these functions. The last two tests are what is called "unit tests". Unit tests can examine other properties of a program rather than just what the output will be. Each unit tests includes a description. If you fail one of these tests, an message will be printed that can help you determine what the reason was for the unit test to fail. Style guidelines Be sure you are following to the programming style guidelines as outlined in the CS 1104 Style Guide document, which can be found on Brightspace under Content Course Documents. These include: Completed comments headers at the top of the program. Use of correct style for naming variables and functions. Line lengths under 100 characters for all lines. At least one empty line between function definitions. Comment headers above each defined function. Since this is the first time you are writing comment headers for functions, the following is an example of comment headers for the print_tree function, which you may use. IR TT 11 Prints a tree. def print tree(): # Start of statements for the print tree function

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_2

Step: 3

blur-text-image_3

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

Oracle 10g Database Administrator Implementation And Administration

Authors: Gavin Powell, Carol McCullough Dieter

2nd Edition

1418836656, 9781418836658

More Books

Students also viewed these Databases questions

Question

e. What happens to our real exchange rate?

Answered: 1 week ago

Question

long summary of To kill a mocking bird by harper lee

Answered: 1 week ago

Question

How much did the company purchase from that supplier?

Answered: 1 week ago

Question

What is the total amount of cash paid to suppliers for 2020?

Answered: 1 week ago