Class 32 — November 12

Everything is functioning aok

Part two is ending — Soon time to show mastery — Expect to do well


Look both ways


Agenda


Homework solutions


What to expect for the test


List patterns

result = ...

for element in the_list :

  ...

return result

n = len( the_list )

for i in range( 0, n ) :

  element = the_list[ i ]

  ...

  the_list[ i ] = element

v = 1112


the_list = the_list + v # cannot add a list and a non-list


the_list = the_list + [ v ] # can add a list and a non-list

  • Appends v to end of the_list
  • Returns the number of occurrences of v in the_list
  • Removes first occurence of v from the_list
  • Index of first occurrence of v in the_list
  • Concatenates list1 and list2 to make list3

Functions

def name ( parameters ) :


Warnings


Past Q & A




q & a session

 


 

 

 
   
   
   
 
  © 2019 Jim Cohoon   Resources from previous semesters are available.