Class 7 – Wednesday, January 29

Make Bill Murray proud

Take another step — Chrestomathics awaits you — Feel the momentum

All Hoos got your back — A single community — In it together


Look both ways


Survey


Is a rose by any other name still a rose


Agenda


Downloads


Office hours

Times TBD

Location Thornton A Stacks

top floor of thorton -- the stacks



To do list


Program subscripting.py

Program output

### [] is the string index operator

s = obliviator

  0123456789

n = len( s ) = 10

### If the [] operand is an integer value, it is subscripting

s[ 0 ] = o

s[ 4 ] = v

s[ n-1 ] = r



Program love_is_all_you_need.py

Some program runs

Enter number of lines to be printed: 5

Love is all you need

Love is all you need

Love is all you need

Love is all you need

Love is all you need

Enter number of lines to be printed: 1

Love is all you need

Enter number of lines to be printed: 0



Program temperature.py

f = 9/5 * c + 32

Enter Celsius temperature: 24

24 C = 75.2 F

24 C = 75 F

Enter Celsius temperature: 8

8 C = 46.4 F

8 C = 46 F

 


Program break_the_bank.py

Number of quarters, dimes, nickels, and pennies: 27 14 28 18

Coinage

    27 quarters

    14 dimes

    28 nickels

    18 pennies

are worth 9.73 dollars

Number of quarters, dimes, nickels, and pennies: 1 2 3 4

Coinage

    1 quarters

    2 dimes

    3 nickels

    4 pennies

are worth 0.6400000000000001 dollars



bill murray



 


 
  © 2020 Jim Cohoon   Resources from previous semesters are available.