Python 3.6.1 >>> %Run nested.py >>> nestedLoop1(3,5) i= 1 j= 1 i= 1 j= 2 i= 1 j= 3 i= 1 j= 4 i= 1 j= 5 i= 2 j= 1 i= 2 j= 2 i= 2 j= 3 i= 2 j= 4 i= 2 j= 5 i= 3 j= 1 i= 3 j= 2 i= 3 j= 3 i= 3 j= 4 i= 3 j= 5 done >>> %Run nested.py >>> nestedLoop2(5) 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 >>> %Run nested.py >>> nestedLoop3(5) 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 >>> %Run L17-dict.py >>> r = find_min_max([2, 5, 11, 10]) >>> r (2, 11) >>> m, x = find_min_max([2, 5, 11, 10]) >>> m 2 >>> x 11 >>> german = german_dict() >>> german['to see'] 'sehen' >>> german.items() dict_items([('cat', 'die Katze'), ('dog', 'der Hund'), ('to see', 'sehen'), ('to drive', 'fahren'), ('sun', 'die Sonne')]) >>> deutsch = german_dict() >>> deutsch {'cat': 'die Katze', 'dog': 'der Hund', 'to see': 'sehen', 'to drive': 'fahren', 'sun': 'die Sonne'} >>> deutsch.keys() dict_keys(['cat', 'dog', 'to see', 'to drive', 'sun']) >>> deutsch.values() dict_values(['die Katze', 'der Hund', 'sehen', 'fahren', 'die Sonne']) >>> print_items(deutsch) Key is: cat -- Value is: die Katze Key is: dog -- Value is: der Hund Key is: to see -- Value is: sehen Key is: to drive -- Value is: fahren Key is: sun -- Value is: die Sonne >>> print_items(5) Traceback (most recent call last): File "", line 1, in File "/Users/briggs/Dropbox/Courses/CS101/Spring 2018/examples/L17-dict.py", line 100, in print_items for k, v in d.items(): AttributeError: 'int' object has no attribute 'items' >>> print_lines('alma.txt') Walls of Ivy, paths of beauty, we have known and loved them well, Spired chapel rising proudly, Morning hymn and evening bell. Middlebury, Alma Mater, Symbol of his strength and truth, Symbol of his strength and truth. Sunset glowing o'er the mountains, Snowy peaks and winding ways, Peaceful stillness o'er the campus, Mem'ries of most happy days. Loyal ever in these friendships, We have spent four glorious years. Filling us with hope and courage, Till the hour of parting nears. >>> 'Loyal ever in these friendships'.split() ['Loyal', 'ever', 'in', 'these', 'friendships'] >>> process_file('test.txt') good morning cs101 Have a great day >>> d = dict() >>> d['have'] = d.get('have',1) >>> d {'have': 1} >>> d['a'] = d.get('a',0)+1 >>> d {'have': 1, 'a': 1} >>> d['a'] = d.get('a',0)+1 >>> d {'have': 1, 'a': 2} >>> %Run google.py >>> distance('middlebury,vt', 'burlington,vt') { "destination_addresses" : [ "Burlington, VT, USA" ], "origin_addresses" : [ "Middlebury, VT 05753, USA" ], "rows" : [ { "elements" : [ { "distance" : { "text" : "55.3 km", "value" : 55305 }, "duration" : { "text" : "53 mins", "value" : 3209 }, "status" : "OK" } ] } ], "status" : "OK" } >>> %Run google.py >>> distance('middlebury,vt', 'burlington,vt') 55305 >>> %Run google.py >>> distance('middlebury,vt', 'burlington,vt') 34 >>>