Download Introduction to Computer Programming Study Guide #1

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Proofs of Fermat's little theorem wikipedia , lookup

Transcript
Introduction to Computer Programming Study Guide #2
For loops, strings, and tuples
1. Be able to construct for loops to count through various ranges of integers (positive, negative, ascending,
descending, by values other than one, etc).
2. Know the use of the len() function for strings and tuples.
3. Know the use of the in operator for strings and tuples.
4. Know the use of the [] operator for accessing elements of a string or tuple.
5. Know how the positive and negative indexes are structured.
6. Know the use of the [:] operator for accessing slices of a string or tuple.
7. Know how the positive and negative slices are structured.
8. Understand and know how to build strings using concatenation.
9. Know how to create tuples.
10. Know the syntax for packing and unpacking a tuple.
11. Study all examples in the notes and textbook.
Lists and Dictionaries
1. Be able to construct lists and dictionaries.
2. Know the use of the len() function for lists and dictionaries.
3. Know the use of the in operator for lists and dictionaries.
4. Know the use of the [] operator for accessing elements of a list.
5. Know the use of the [:] operator for accessing slices of a list.
6. Understand how to build lists using concatenation.
7. Understand how to change elements in a list.
8. Understand how to add new or change elements to a dictionary.
9. Know the list methods discussed in class (sort, reverse, count, index, insert, pop, remove).
10. Know the dictionary methods discussed in class (has_key, items, keys, values).
11. Understand the program structure of a “menu driven program”.
12. Understand the concepts of “shared references” in Python.
13. Understand the concepts of nested sequences in Python using strings, tuples, lists, and dictionaries. Be able
to use multiple [] operators to access various elements in a nested sequence.
Functions
1.
2.
3.
4.
Know the Python syntax and be able to write user defined functions
Know the Python syntax and be able call user defined and pre-defined functions
Math functions, Random functions
Be able to pass parameters to functions and return values back from functions
Problems
1. Use a list to solve the following problem. Read in 20 numbers. As each number is read, print it only if it is
not a duplicate of a number already read.
2. Problem 4.1 in the textbook.
3. Problem 4.2 in the textbook.
4. Problem 5.1 in the textbook.
5. Problem 5.3 in the textbook.