1. Make simple calculations using Python, for example the

Transcription

1. Make simple calculations using Python, for example the
Introduction to Computers and Programming
Spring Semester 2015
Important Skills and Techniques
1. Make simple calculations using Python, for example the circumference of a circle
2. Understand the importance of definitions of variables and assignments of values.
Understand the difference between the assignment and the ‘=’ operator
3. Make data type conversions when required in your code
4. Be able to explain the program state during the program execution and side effects of
your code
5. What is an expression and what is a statement and how you can identify expressions and
statements (including sub-expressions within statements or within other expressions)
6. Do Boolean comparisons on strings and integers
7. Understand, use and combine properly the Logical Operators (and, or, not)
8. Use of the ‘in’ operator in Python (for Boolean operations as well as in ‘for’ loops). Also,
the use of in to search through lists and dictionaries
9. Use of an “if-elif-else” triage. When do we need to use elif and when is else used?
10. Use of nested conditionals
11. Make sure you have understood indentation when you code. Be able to understand the
effect of an altered indentation to your program state
12. ‘While’ loops and ‘for’ loops. Understand when you should use each different loop
syntax and how you can use ‘while’ and ‘for’ interchangeably.
13. In ‘for’ loops you should define the range (and your step if needed) correctly. For
example, if you want to process the integers between X, Y, you need to use range(X, Y+1).
14. The use of ‘break’ statement when you want to force termination of the current loop.
15. The use of ‘continue’ statement when you want to skip the rest of the body of the loop
and go directly to the next iteration
16. Count specific elements in a string based on a condition. Here you combine the use of
lists and conditionals and you are also using a variable which serves as a counter
17. Define lists, access element(s) of a list based on their position, populate lists with data,
alter the contents of a list, loop through the elements of one (or more lists) and search
for specific elements/or count the elements
18. Be able to use the important list methods and functions
19. Concentrate data from two lists in one list
20. Map contents of a list with those of another list
21. Create shallow and deep copies of a list and understand how these copies behave in your
program
22. Count the number of times a letter appears in a string, a list, or a file
23. Convert a list to a string. Convert a string to a list. Typical examples involve a change you
want to make to a string, without reassigning a new value to it. In this case you need to
change the string to a list, make the changes and then transform back the list to a string
(with a loop)
24. Compare lists using the ‘is’ keyword
25. Understand the difference between lists and tuples.
26. Access an element of a string by defining the index position of the string
27. Familiarize yourself with the use of important string functions and methods (len, index,
find, isspace, strip)
28. Create a function and use the return value of this function in your main code (you may
need to use import if the function and your main codes are in different files)
29. Understand the concept of the return statement in a function
30. Be able to define the appropriate arguments in your function. Understand the
importance of the ordering of the arguments
31. Understand the step-by-step process of the evaluation of a function
32. You should demonstrate a good understanding of how functions work, by being able to
develop programs with easy calculation functions (like finding divisors or squares of an
integer number etc.) and data preparation functions (like preprocessing a file to discard
punctuations and capital letters)
33. Write simple functions which serve the purpose of error handling. For example, write a
function which checks if a user input is a string which starts with a capital letter and
returns a message otherwise
34. Open a file and write data on it. Data can come from any process in your code (like i.e.
the elements of a list that the user has created)
35. Read a file line by line (using ‘for’ loop), word by word (split function). Understand how a
file is streamed
36. The use of the ‘readline’ function
37. Naturally, you are expected to be able to combine the knowledge you have acquired so
far (loops, conditionals, lists) in programs involving reading files and writing on files
38. Convert any ‘read/write-a-file’ related program to a function (i.e. calculate the number of
words in any given file-to do this it is preferable to ‘package’ your code into a function,
which can be called whenever you want to know about the word count of any file
39. Understand the effect of different write modes on your files
40. You should be able to write a program which copies processed content from a file to a
second output file (i.e. convert to upper case and store on a new file)
41. You should be able to browse through the contents of a dictionary using loops
42. Use of the important dictionary methods and functions: del, len, items, keys, values
43. Formatted output: you should be able to represent lists as matrices (alignments, column
length, type (float, int etc.) in the formatted output
44. When you pair the results from two different lists, you should be able to make your
output nice and clean using formatted output methods