Totem.py
and write functions in that module. The code
you write must conform to the totem standards below. When you create
the module, let Eclipse create the __name__ ==
'__main__'
boilerplate for you.
For example function names can be chin_cleft
,
hair_bald
, mouth_open
, or
mouth_v1
. You cannot use a name
like mouth
or earClogged
because these don't
conform to the naming specification. The "meaningful"
description can be anything.
hair_part
below:
17*k + (k-1)
where k is the number
of lines represented by the string. A one-line string will be exactly
17-characters, a two-line string will be two lines of 17 separated by
one new line character so it's length will be 35 = 17*2 +
(2-1)
characters
Some of the characters in each line can be spaces, but each must have length seventeen as a string (again, multi-line strings are fine).
totem
and another should be named
randompole
. The first will print the same totem-pole each
time it is called. The totem-pole must consist of at least three
different "heads". You can also write functions to create
individual heads that print the values returned by the so-called
parts functions.
The function, randompole
, should create different
poles each time it is called based on using the Python random
module and using if/elif statements.
totem
that results in generating three totem heads.
main
Python idiom we've seen to run
either totem
or randompole
when the
program is run, e.g., from Eclipse:
totem
function as well, not
just the randompole
function.
hairParted
that conforms to the totem standards.
def hairParted(): return " "*7 + r"\\\\\\\\//"Note that 7 spaces are concatenated to 10 characters in a raw string.
random
library
and then call the function random.random(low,high)
. The
example below returns three different strings with equal
probability.