Difference between revisions of "CSC111 Mid-Semester Review 2018"

From dftwiki3
Jump to: navigation, search
(Lists)
Line 33: Line 33:
 
* is  
 
* is  
 
   
 
   
  a = ''
+
  a = ""
 
   
 
   
 
:a valid string?
 
:a valid string?

Revision as of 19:50, 4 March 2018

D. Thiebaut (talk) 19:17, 4 March 2018 (EST)


Preparation

TheAnswerPad.png

Range

  • Is range a function?
  • How many parameters does it take?
  • What are they?
  • Can range crash if we give it incompatible parameters?
  • Can its parameters be variables? i.e. range( a, b, c)?
  • When is range() useful?

Lists

  • How are lists defined?
  • What different symbols are used to define lists?
  • Can we mix the symbols to open and close the list?
  • Can lists be empty? If so, give examples of empty lists.
  • Can list elements be of different types? Can a list element be another list?
  • Can list grow? How?
  • How can we replace the first element of a non-empty list with a different value?
  • How can we remove the first element of a non-empty list?
  • How can we remove the last element of a non-empty list?
  • How can we create a list that is the concatenation of two lists?

Strings

  • Are strings mutable?
  • is
a = ""

a valid string?
  • How can we remove the first letter of a non-empty string?
  • How can we remove the last letter of a non-empty string?
  • How can we create the reverse of a string ("hello" --> "olleh")
  • How do we go from "The quick red fox" to [ "The", "quick", "red", "fox"]?
  • How do we go from " The quick red fox " to [ "The", "quick", "red", "fox"]?