Presentation is loading. Please wait.

Presentation is loading. Please wait.

Midterm Exam Topics (Prof. Chang's section) CMSC 201.

Similar presentations


Presentation on theme: "Midterm Exam Topics (Prof. Chang's section) CMSC 201."— Presentation transcript:

1 Midterm Exam Topics (Prof. Chang's section) CMSC 201

2 Midterm Topics Variables assignment expressions types strings lists input function print function Unix commands Boolean expressions if statements nested if statements cascading if statements while loops for loops nested loops

3 Not on Midterm Base conversion Emacs Intentional syntax errors The answer is never "There's no output because the program has a syntax error" functions Python 2

4 Tasks on Midterm You may be asked to: produce the output of a program fragment trace the execution of a program write small programs use input( ) and print( ) functions use lists and strings

5 Variables, assignments, expressions & type Python variables are not typed, but Python values have type. Types you need to know: integer, float, string, list, boolean. Trace through a program fragment and figure out the value stored in a variable. Be familiar with operators: +, –, *, /, **, //, % Operator precedence

6 Strings and Lists Know the difference between strings and lists. Lists can have items of different type. Use [ ] for indexing and slicing Work with strings and lists using a for loop and/or a while loop. + operator on strings and lists.append( ) method for lists

7 input() and print() Be able to write programs with input and print Use print with and without newlines Work with return values from input (Python 3).

8 Unix commands cd change directory lslist files in current directory mkdirmake new directory

9 Boolean Expressions True and False in Python Relational operators: = > Boolean operators: and or not Short circuit evaluation Can store Boolean values using assignment

10 if statements if statements with and without an else part nested if statements cascading if statements using elif write program fragments using if statement

11 while & for trace program fragments and write down output write your own program fragments with while / for work with strings and lists nested while and for loops for loops using range( ) for loops using: for item in aList:

12 format Some True/False questions (no partial credit) Some multiple choice questions (no partial credit) Some short responses Some long responses (write a program)


Download ppt "Midterm Exam Topics (Prof. Chang's section) CMSC 201."

Similar presentations


Ads by Google