Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using the IDLE development environment, create a Python script namedtryme4.py.(Note: an alternative to IDLE is to use a free account on the pythonanywhere website:https://www.pythonanywhere.com/) IDLE

Using the IDLE development environment, create a Python scriptnamedtryme4.py.(Note: an alternative to IDLE is to use a free account on the pythonanywhere website:https://www.pythonanywhere.com/)

IDLE has both an interactive mode and a script mode. You must use thescriptmode to develop your script. Your script must use meaningful variable names and have comments that describe what is happening in your script. Comments may describe the assignment of a value to a variable, a computation and the assignment of the result to a variable, or the display of the result.

Write a function in this file callednine_linesthat uses the functionthree_lines(provided below) to print a total of nine lines.

Now add a function namedclear_screenthat uses a combination of the functionsnine_lines,three_lines, andnew_line(provided below) to print a total of twenty-five lines. The last line of your program should call firstnine_linesand then theclear_screenfunction.

Thefunctionthree_linesandnew_lineare defined below so that you can see nested function calls. Also, to make counting "blank" lines visually easier, theprintcommand insidenew_linewill print a dot at the beginning of the line:

def new_line():

print('.')

def three_lines():

new_line()

new_line()

new_line()

Submit your Python script file in the posting of your assignment. Your Python script should be either a.txtfile or a.pyfile.

You must execute your script and paste the output produced into a document that you will submit along with your Python script.

It is very helpful if you print a placeholder between the printing of 9 lines and the printing of 25 lines. It will make your output easier to read for your peer assessors. A placeholder can be output such as "Printing nine lines" or "Calling clearScreen()".

The following items will be used in the grading rubric for this assignment. Make sure that you have addressed each item in your assignment.

  • Does the assignment implementnew_line,three_lines,nine_lines, andclear_screenfunctions, as well as a mainsection of the program which calls the functions?
  • Does the assignment demonstrate the use ofnestedfunction calls?
  • Does the assignment produce the appropriate output when executed? The output should be recorded in a text file, a Microsoft Word document, or an RTF-formatted document by copying the output from the Python script into the document. The successful script will print out 9 "." lines first and then 25 "." lines.
  • Does the program code include comments where appropriate?

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

Students also viewed these Programming questions