Final 2 Flashcards
(16 cards)
Trivia: What reference did the professor make in the powerpoint for the lecture on loops?
Cars - I’m not the one
“Goin’ round and round…”
Most general type of loop
While
What is a sentinel?
An event or value read in that stops a loop from executing when it occurs
What does “robust” mean in terms of a program?
That it does not easily crash
What function returns the number of elements in a list given as its argument?
len()
Syntax len([1,2,3])
returns 3
Is len a method?
No, it’s a function which takes an argument. A method with regards to this class uses dot notation to be called.
Trivia: 1993 Movie that uses the concept of a loop.
Groundhog Day
Trivia: What TV show was used as a reference for and/or statements?
Get Smart
Trivia: What TV show was referenced for short circuit evaluation?
Wings (“Did Roy Biggens really Steal $250,000?”)
What does short circuit evaluation do?
Terminates an evaluation of the condition when the overall answer is already known or obvious (or/and operators come into play here)
Trivia: What movie was used to illustrate the concept of what would happen if no short circuit evaluation was used?
Wrongfully Accused (“Bus Scene”)
The people back off the road and fall down a hill.
True/False boolean values are sometimes referred to as what?
flags
Trivia: What song was used as a reference when trying to “see” invisible characters such as tab? (Special/Escape characters)
DC Talk - “Mind’s Eye”
What would print(“\n\n\n”) output?
\n\n\n
What does print(r”c\n\na”) output? Why?
c\n\na because the r modifier in front of the string denotes that it is “raw”, so it should be read literally and ignore any special/escape characters.