Class 05 – Friday, September 1

It's all about you

Show understanding — Put it altogether now — Yes you all can do

Help crush breast cancer — For your families and friends — Not be asunder


Look both ways


Downloads — get them all, some have been updated

 


Agenda


Future homework requirements and facts


Program cast_away.py

i: 1

f: 2.9

c: '33'

d: '4.5'

int( f ): 2

float( i ): 1.0

int( c ): 33

float( d ): 4.5


Program favorite_word.py


Another use of the built-in function input().

Introduces the built-in function len().


Tell me a favorite word: crwth

 

Did you know that crwth has length 5

Tell me a favorite word: strengths

 

Did you know that strengths has length 9

Tell me a favorite word: scraunched

 

Did you know that squirreled has length 10



Program hip_hopping.py



How many rabbits: 2

Growth rate per generation: 2

Generation: 1

Rabbits: 2

Generation: 2

Rabbits: 4

Generation: 3

Rabbits: 8

Generation: 4

Rabbits: 16

How many rabbits: 6

Growth rate per generation: 2

Generation: 1

Rabbits: 6

Generation: 2

Rabbits: 12

Generation: 3

Rabbits: 24

Generation: 4

Rabbits: 48

How many rabbits: 4

Growth rate per generation: 5

Generation: 1

Rabbits: 4

Generation: 2

Rabbits: 20

Generation: 3

Rabbits: 100

Generation: 4

Rabbits: 500



Program combine_replicate.py

Enter word: fire

Enter word: fighter

Enter phrase: Wah-Hoo-Wah!

word1: fire

word2: fighter

phrase: Wah-Hoo-Wah!

### operator + performs concatenation

word1 + word2: firefighter

### operator * performs concatenation

n: 3

n * phrase: Wah-Hoo-Wah!Wah-Hoo-Wah!Wah-Hoo-Wah!



Program complimenter.py



  Enter your age: 19

  You don’t even look 14

  Enter your age: 111

  You don’t even look 106

  Enter your age: 20

  You don’t even look 15



Program dateable.py

  • You should only date someone who is at least seven years older than than half your age.


  Enter your age (integer): 19

  19 year olds should date somebody who is at least 16 years old

  Enter your age (integer): 22

  22 year olds should date somebody who is at least 18 years old

  Enter your age (integer): 88

  88 year olds should date somebody who is at least 51 years old



To do list




wikimedia creative commons license rabbits galore


open clipart derived crwth