Class 05 – Friday, January 28

It's all about you

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


Look both ways


Downloads — get them all, some have been updated

 


Program floatilla.py

Values of interest

x: 2.71

y: 3.14

Results

x + y: 5.85

x - y: -0.43000000000000016

x * y: 8.5094

x / y: 0.8630573248407643

x // y: 0.0

x ** y: 22.883559193263366

x % y: 2.71



Agenda


Future homework requirements and facts


Program favorite_word.py

input() and len()

Tell me a favorite word: zeitgeist

 

Did you know that zeitgeist has length 9

Tell me a favorite word: akimbo

 

Did you know that akimbo has length 6



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

 


  🦆 © 2022 Jim Cohoon   Resources from previous semesters are available.