Python 3.5.2+ (default, Sep 22 2016, 12:18:14) [GCC 6.2.0 20160927] on linux Type "copyright", "credits" or "license()" for more information. >>> =========== RESTART: /home/brent/teaching/150/lectures/S17/for.py =========== >>> find("hello", 'l') 2 >>> find("hello", 'o') 4 >>> find("hello", 'x') >>> =========== RESTART: /home/brent/teaching/150/lectures/S17/for.py =========== >>> find("hello", 'x') -1 >>> find("hello", 'l') 3 >>> =========== RESTART: /home/brent/teaching/150/lectures/S17/for.py =========== >>> find("hello", 'x') -1 >>> find("hello", 'l') 2 >>> find("hello", 'o') 4 >>> find("hello", 'h') 0 >>> =========== RESTART: /home/brent/teaching/150/lectures/S17/for.py =========== >>> oogie([1,3,10,2,4,900,3,2]) 900 >>> oogie('oijerfERFZZf') 'r' >>> oogie(['dog', 'cat', 'ostrich', 'heffalump']) 'ostrich' >>> oogie(1370) Traceback (most recent call last): File "", line 1, in oogie(1370) File "/home/brent/teaching/150/lectures/S17/for.py", line 63, in oogie p = m[0] TypeError: 'int' object is not subscriptable >>> oogie("1370") '7' >>> =========== RESTART: /home/brent/teaching/150/lectures/S17/for.py =========== >>> yaya('hello') True >>> yaya('12345') False >>> =========== RESTART: /home/brent/teaching/150/lectures/S17/for.py =========== >>> yaya('hello') True >>> yaya('12345') Traceback (most recent call last): File "", line 1, in yaya('12345') File "/home/brent/teaching/150/lectures/S17/for.py", line 72, in yaya if q[y] == q[y+1]: IndexError: string index out of range >>> =========== RESTART: /home/brent/teaching/150/lectures/S17/for.py =========== >>> =========== RESTART: /home/brent/teaching/150/lectures/S17/for.py =========== >>> is_sorted("help") True >>> =========== RESTART: /home/brent/teaching/150/lectures/S17/for.py =========== >>> is_sorted("help") False >>> is_sorted([1,2,3,4,5]) True >>> is_sorted([1,2,3,5,4]) False >>> is_sorted([1,2,3,5,5]) True >>> pulu(4) Traceback (most recent call last): File "", line 1, in pulu(4) NameError: name 'pulu' is not defined >>> =========== RESTART: /home/brent/teaching/150/lectures/S17/for.py =========== >>> pulu(4) [0, 1, 8, 27] >>> pulu(20) [0, 1, 8, 27, 64, 125, 216, 343, 512, 729, 1000, 1331, 1728, 2197, 2744, 3375, 4096, 4913, 5832, 6859] >>> pulu('dog') Traceback (most recent call last): File "", line 1, in pulu('dog') File "/home/brent/teaching/150/lectures/S17/for.py", line 84, in pulu for k in range(r): TypeError: 'str' object cannot be interpreted as an integer >>>