Class 5 – Friday, September 4

It's all about you

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

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


Talk before knowing — Something very tough for me — I wonder why that is

CS is alright — Paying attention is key — It can be fun too


Look both ways


Downloads


Agenda


All future homework requirements


To do list


Program casting.py

integer_string = '112358'

decimal_string = '93.86'

decimal_number = 9.04

integer_number = 1112

i1 = int( integer_string )

i2 = int( decimal_number )

f1 = float( integer_number )

f2 = float( decimal_string )

112358 + 9 = 112367

1112.0 + 93.86 = 1205.86

nbr1 = 14

nbr2 = 1.5

s1 = str( nbr1 )

s2 = str( nbr2 )

'14' + '1.5' = '141.5'



Program being_powerful.py

Enter base (integer): 2

Enter exponent (decimal): 0.5

 

1.4142135623730951

Enter base (integer): 11

Enter exponent (decimal): 3.14

 

1861.971509290233

Enter base (integer): 9

Enter exponent (decimal): 99.9

 

2.132201+95



Program trio.py

  • The final version of the program shows that every string has a member function for inspecting itself. The split() function hands back the list of words that make up the string.

What are your three favorite words: peace joy friends

 

peace

joy

friends

What are your three favorite words: you me us

 

you

me

us

What are your three favorite words: subcontinental nudiustertian uncopyrightable

 

subcontinental

nudiustertian

uncopyrightable



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 tao.py

Enter rectangle width and height (integers): 5 6

 

30

Enter rectangle width and height (integers): 2 71

 

142

Enter rectangle width and height (integers): 3 14

 

42



variables as boxes

 


  © 2020 Jim Cohoon   Resources from previous semesters are available.