Starting from:

$29

Recitation Week 2 – Basic Output

CMPSC 101 
Introduction to Programming with Python 
Recitation Week 2 – Basic Output
Problem 1. Write a single print statement that gives the following output: [10 pts]
3 2 1 Go!
Note: Whitespace (blank spaces / blank lines) matters; make sure your whitespace exactly
matches the expected output.
Problem 2. Write a single print statement that gives the following output: [10 pts]
Mon Tue Wed
Thu Fri Sat
Sun
Hint: Use tabs (\t) and newlines (\n).
Problem 3. Complete the given program (the print statement) such that it gives the output as
shown: [15 pts]
Code:
myAge = 20
print (your code goes here)
Output:
I am 20 years old.
Note: Use the variable myAge to display the age.
Problem 4. Write a python script to display the following figure: [15 pts]
***
| |
***
| |
***
Note: Whitespace (blank spaces / blank lines) matters; make sure your whitespace exactly
matches the expected output. Do not leave trailing spaces at the end of each line.
Discussion 1. Draw a flowchart and write a program to calculate the area of a rectangle with
width of 4.5 and height of 7.9 using the formula 𝑎𝑟𝑒𝑎 = 𝑤𝑖𝑑𝑡ℎ × ℎ𝑒𝑖𝑔ℎ𝑡. Use the following
pseudo-code as a guide:
1. Assign value 4.5 to variable width.
2. Assign value 7.9 to variable height.
3. Compute the area.
4. Display the result.

More products