DEV Community

C O S M A T
C O S M A T

Posted on

Assignment

Please guys I need your help on my assignment

Top comments (3)

Collapse
 
tdaniel344 profile image
C O S M A T

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

IDLE has both an interactive mode and a script mode. You must use the script mode 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 called nine_lines that uses the function three_lines (provided below) to print a total of nine lines.

Now add a function named clear_screen that uses a combination of the functions nine_lines, three_lines, and new_line (provided below) to print a total of twenty-five lines. The last line of your program should call first nine_lines and then the clear_screen function.

The function three_lines and new_line are defined below so that you can see nested function calls. Also, to make counting “blank” lines visually easier, the print command inside new_line will 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 .txt file or a .py file.

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 implement new_line, three_lines, nine_lines, and clear_screen functions, as well as a main section of the program which calls the functions?

Does the assignment demonstrate the use of nested function 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?

Collapse
 
tdaniel344 profile image
C O S M A T

Assignment no 2
Create your own python codes example that demonstrate each of the following

Example 1: Define a function that takes an argument. Call the function. Identify what code is the argument and what code is the parameter.

Example 2: Call your function from Example 1 three times with different kinds of arguments: a value, a variable, and an expression. Identify which kind of argument is which.

Example 3: Create a function with a local variable. Show what happens when you try to use that variable outside the function. Explain the results.

Example 4: Create a function that takes an argument. Give the function parameter a unique name. Show what happens when you try to use that parameter name outside the function. Explain the results.

Example 5: Show what happens when a variable defined outside a function has the same name as a local variable inside a function. Explain what happens to the value of each variable as the program runs.

Collapse
 
tdaniel344 profile image
C O S M A T

Please the deadline to this assignment is Nov 26
Thanks