0% found this document useful (0 votes)
2 views

02 Performance Task 1

The document outlines a performance task for using Python's print() function to output song lyrics. It includes instructions for inserting new lines, using multiple arguments, and applying keyword arguments like end and sep. Screenshots of the console output are required for each step of the task.

Uploaded by

kimberlylesliea
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

02 Performance Task 1

The document outlines a performance task for using Python's print() function to output song lyrics. It includes instructions for inserting new lines, using multiple arguments, and applying keyword arguments like end and sep. Screenshots of the console output are required for each step of the task.

Uploaded by

kimberlylesliea
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Name: Jerick Soliman

Performance Task
Python Semantics

On your IDLE (or https://edube.org/sandbox), use two (2) separate print() functions that
output two (2) lines of any song, such as the following:
Humpty Dumpty sat on a wall, Humpty Dumpty had a great fall.
This program invokes the print() function twice. The two (2) separate lines in the console
mean that print() begins its output from a new line each time it starts its execution.
Also, each print() invocation contains a different string. This means that the instructions
in the code are executed in the same order they have been placed in the source file.

Insert an additional empty print() function invocation between the first two (2) function
calls. This empty print() must produce a new line in the console output. Provide a
screenshot of the console.
\n is an escape character that inserts a new line in the output. The backslash (\) indicates
that the string includes a special instruction, and n stands for 'newline'.
In your current code, insert \n between the two (2) arguments in the print() function.
Provide a screenshot of the console.
You can pass multiple arguments to the print() function by separating them with commas.
Modify the first print() function invocation to use three (3) separate arguments, separated
by commas. Each argument should correspond to a part of the original string. Provide a
screenshot of your code.
Python passes arguments in various ways. One is by the mechanism called keyword
arguments the name comes from the fact that the meaning of these arguments is taken,
not from their location/position, but from the special word (keyword) used to identify them.
The first one is the end keyword.

On your current code from Step 4, add end=" (containing one space) at the end of the
first print() function invocation. Re-add the second one. Provide a screenshot of the
console. Another keyword argument that can be used to pass an argument is sep
(separator).

For this one, separate the original string of your second print() function invocation per
sentence. This time, add sep="" at the end of the argument. Note that the value inside the
sep can be changed to anything. Provide a screenshot of the console.
Additionally, the end and sep keywords can be used in the same function invocation, Do
it on both functions. Provide a screenshot of the output.

You might also like