CSC207H1 Study Guide - Midterm Guide: Getopt, Makefile, Javac

78 views4 pages
24 Sep 2012
School
Course
Professor

Document Summary

E3 part 3 asked you to write a python tool summarizelog. py, which was called as follows: python summarizelog. py [-d startdate enddate] The square brackets indicated that these three arguments were optional. Make the options 2 ags: -s startdate -e enddate and allow them to come in either order. They could have use standard command line parsing modules, and in particular getopt. Sets a point where the code will stop executing. When the current line of code has no method call. The following code produces this output: ["hey", "dude", "lol", its", my, bad] # module cooltester. py from cool import cooltalker from myerrors import notranslationerror translator = cooltalker() translator. addword("hey", "hello") translator. addword("dude", "friend") translator. addword("bad", "fault") translator. addword("lol", "ha") # is no translation for a word. class notranslationerror(valueerror): def __init__(self): Valueerror. __init__(self) sentence = ["hello", "friend", "ha", "its, my, fault] newsentence=[] for word in sentence: try: newword = translator. tocool(word) except notranslationerror: newword = word newsentence. append(newword) print newsentence.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents

Related Questions