Processing math: 100%
< Back

Lab 11: Images


Practice Problem 1

Write a function called make_excited(phrase), which takes a string as a parameter. Your function should print the phrase that was passed as a parameter with an exclaimation point at the end.

Example

>>> make_excited("Hi")
Hi!
>>> make_excited("INQ 241A")
INQ 241A!

Hint


Practice Problem 2

Write a function called cube_surface_area(side_length), which takes a single integer as a parameter. Your function should print what the area is of a cube with those specified dimensions. Remember that a cube is 6 squares, all of which have dimensions of side_length×side_length.

Example

>>> cube_surface_area(1)
6
>>> cube_surface_area(2)
24
>>> cube_surface_area(3)
54

Hint


Lines

In a file called lines.py, write a function called draw_lines(width, height). This function should create a new picture of the specified size. It should then add red pixels into the image, to make the following pattern.

Example

Hint