Class 42 April 30
I know that you know that
Programming basics — You achieved this semester — Bask in the success
Always look both ways
Update
- Link to common_commodities.py is available
- Links to today’s artifacts are available
- Viewable link to Test 1 artifacts is available
- Viewable link to Test 2 artifacts is available
Students with accomodations
- Please report on Thursday to Room 536 at 4 PM, if you get double time
- Please report on Thursday to Room 536 at 5:30 PM, if you get 1.5 time
- Please report on Thursday to Room 535 at 7:00 PM, if you get a quieter space.
Agenda
- Be chrestohistorical
Thanks to the undergraduate TAs for making the course a success
|
|
|
|
Want to be a CS 1112 TA in the spring
- Please fill out the departmental application
Important patterns
- Print output
- Get input
- Convert input to data
- Perform calculations
- Process strings
- Get web input
- Use to do above and below tasks
- Examine and create lists
- Convert a string into a list of strings
- Convert a list of strings into a list of numbers
- Perform an accumulation
- Build a string, list, or sum
- Check to see if the elements of the list are all of the same form
- Check to see if any element of the list has a desired form.
- Find first / last index of an item with a property
- Compare two lists
- Synthesize two lists
- Generate random data
- Get a random value from a range
- Select a random element from a list
- Produce a random tuple
- Produce random lists and tables
- CSV data
- Convert a list of CSV-strings into a new list of lists
- Examine and create dictionaries
- Convert a list of tuples into a dictionary
- Convert a list of two-element lists into a dictionary
- Examine a list with respect to a dictionary
- Examine a table
- Perform an accumulation
- Process a table on a row by row basis
- Convert cells from strings to numerics
- Check to see if all data cells in the table are of the same form
- Check to see if any data cells in the table are of the desired form
- Check to see if all rows in the table are of the same form
- Check to see if any rows in the table are of the desired form
- Design, implement, analyze functions that can encapsulate the above tasks
- Photo manipulation
Realizations
- A variable has an identity and a type
- The value of a variable indicates where the object which it represents can be found
- Strings are immutable
- Converting string data to numeric data.
- To hand back a single integer value
nbr
from a single numeric representationv
nbr = int( v )
- To hand back a list of integer values nbrs from a string list strings
nbrs = []
for v in s :
nbr = int( v )
nbrs.append( nbr )
- A function invocation cannot change the identity of an argument
- All functions return a value either explicitly or implicitly. If there is no explicit return, None is returned.
Truisms
- The test will cummulative.
- The test points are likely to be ~135.
- Questions can require in part familiarity with
- Fundamental types; e.g.,
int
,float
, andstr
- Arithmetic operators; e.g.,
+
,-
,*
,**
,/
,//
, and%
- Identifiers, keywords, variables, objects, values, and references
- Logical and relational operators;
and
,or
,not
,==
,!=
,<
,>
,<=
, and>=
- Control constructs; e.g.,
if
,for
, andwhile
- Nested
for
constructs
- Random value manipulation
random.seed()
random.randrange()
random.choice()
- Builtin-in functions; e.g.,
print()
,input()
,int()
,float()
,str()
,max()
,min()
,len()
,type()
, andid()
- URLs and web files; e.g., numeric, text and CSV contents
- Ranges
- Data structures and their use:
list
,dict
, tuples, methods and slicing
- Functions, parameters, definitions, and invocations
- Colors and PIL Image
Worth a 1000 words
Final thought
- I say thanks to you — Your presence is a great gift — Brings me happiness
Warning: fopen(/l/cs1112/public_html/defs/htm/181-trailer): Failed to open stream: No such file or directory in /l/cs1112/public_html/defs/php/read.php on line 5
Unable to open file!