Script started on Thu Dec 5 10:15:35 2013 [?1034hbash-3.2$ pwd /Users/charles/Dropbox/courses/CMSC 331 Fall 2013/python bash-3.2$ ./cs.py Hello, world Usage: ./cs.py and no arguments 7 Hello there! The name of this program is ./cs.py Please give me a number: If we add 10 to your number, we get 16 That input string was of length 1 BOB should be BOB What objects are in the default namespace? ['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', 'lucky', 'number', 'plusTen', 'sys'] What is the type of plusTen? Let's import the math module and see what objects we now have... ['__doc__', '__file__', '__loader__', '__name__', '__package__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'copysign', 'cos', 'cosh', 'degrees', 'e', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'hypot', 'isfinite', 'isinf', 'isnan', 'ldexp', 'lgamma', 'log', 'log10', 'log1p', 'log2', 'modf', 'pi', 'pow', 'radians', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc'] the square root of 2 is 1.4142135623730951 The first character of 'Robert' is R The last character of 'Robert' is t First element of foo is able Last element of foo is charlie Now, the last element of foo is 17 Now, foo is ['baker', 'charlie', 'delta', 17] ['baker', 'charlie', 'delta', 17] ['cat', 'charlie', 'delta', 17] ['baker', 'charlie', 'delta', 17] Welcome to the Fibonacci Sequence 1 1 2 3 5 8 where is the origin? (0, 0) {'aa': 0, 'bbb': 3} 1.4142135623730951 (-4+0j) (-2+0j) Here is an octal constant 63 Here is a hex constant 255 sometimes a string can span a line break print in else clause Hello Hello Hello no joy found it Snagelpuss[1:4] is nag Snagelpuss[6:] is ss 3 ['t', 'i', 'a', 'l', 'o', 'w'] [0, 0, 0, 0, 0] ['cat', 'dog', 'eagle', 'fox'] ['cat', 'dog', 'eagle', 'fox'] one at a time cat dog eagle fox 0 2 4 6 8 min, max, and sum are builtin 0 8 20 (-1.0, -1.0) i 56 r 34 56 34 {} {'i': 56, 'r': 34} {'i': 60, 'r': 34, 'j': 30} False {'r': 34, 'j': 30} 5 4 3 2 1 earth/mars/venus Example of lambda expression 7 Curry, anyone? -- Charles The value of PI is approximately 3.142. This file ./cs.py has a length of 9523 1 2 Should have printed: 1 2 The members of aPoint are: {'_R2Point__y': 2, '_R2Point__x': 1} which should be the same as {'_R2Point__y': 2, '_R2Point__x': 1} dict_keys(['_R2Point__y', '_R2Point__x', 'z']) should look like 1 2 4 [ 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 2 2 5 5 10 11 16 15 15 32 33 39 68 83 90 111 121 150 151 206 201 275 229 271 320 329 321 355 364 402 370 385 396 386 379 392 375 334 323 313 249 246 244 199 176 174 140 107 110 96 77 74 51 37 28 15 16 17 19 11 6 7 4 1 2 3 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0] bash-3.2$ exit Script done on Thu Dec 5 10:15:50 2013