πΆ DRY
December 15, 2016Do Now (in π CS9 Python)
Write a function called hello
that takes two parameters a name
and an adjective
and combines them. It should work like this:
hello('SK','awesome')
Hey SK, you are very awesome.
DRY: Donβt Repeat Yourself
dry = "Don't repeat yourself"
for x in dry:
print(dry)
Lab 2.1 - Geometric Fun Times v3.0β’
Remember when you drew all those shapes? Didnβt it seem like it should be easier? Wellβ¦
Do you notice a pattern for the number of sides of a shape, the number of repeat and the turn π ___ degrees for each shape? Hmmβ¦thatβs interesting.
1β£ def
ine a function called sides()
that asks for the number of sides and draws a regular polygon with that number of sides. For example, shape(4)
would draw a square, shape(5)
a pentagon, and so on.
2β£ def
ine a function called angle()
that asks for a number of degrees to turn. This should work like shape()
, but every side should be a different color. To make something pretty, test angle(121)
.
This is angle(200)
: