270 likes | 498 Views
CS 1301. Jeopardy. Hosted by Jay. © Don Link, Indian Creek School, 2004. Robot . True?. Programs. Data Types. Potpourri. $200. $200. $200. $200. $200. $400. $400. $400. $400. $400. $600. $600. $600. $600. $600. $800. $800. $800. $800. $800. $1000. $1000. $1000.
E N D
CS 1301 Jeopardy Hosted by Jay © Don Link, Indian Creek School, 2004
Robot True? Programs Data Types Potpourri $200 $200 $200 $200 $200 $400 $400 $400 $400 $400 $600 $600 $600 $600 $600 $800 $800 $800 $800 $800 $1000 $1000 $1000 $1000 $1000
This myro function returns 0 or 1 value(s) based upon obstacles behind the robot. Robot for $200 getIR()
Motors(-1,1) causes the robot to do this. Spin counter- clockwise (left). Robot for $400
Range of possible values returned by the getObstacle() function. 0 to 7000 Robot for $600
The dimensions of the picture returned by the takePicture() function. Robot for $800 256 (X) by 192 (Y)
Difference between the getLight() and getBright() functions. Robot for $1000 getLight() returns values from sensors on robot, getBright() returns sum of pixel values from fluke camera.
What is the values of: ( (14 >= 0) or (4 != 3) ) True? for $200 True
All recursive functions have these 2 parts: a base (terminating) case, and a recursive call. True? for $400 False
getIR(“left”) and (5 % 2 == 3) True? for $600 False
for i in range(5,3,-1): if (i % 2 == 0): return True else: return False False True? for $800
( (5 > 4) or (10 >= 10) ) or (not (5 / 4 == 1)) True True? for $1000
What this program prints: for i in range(10): print i + 1 Numbers 1 through 10, one per line. Programs for $200
x = 5 while (x > 0): print x x = x-1 Programs for $400 Numbers 5 to 1, one per line
Write this using a while loop: for i in range(5,10,2): print i Programs for $600 x = 5 while ( x < 10): print x x = x+2
Result of mystery(2,3): def mystery(a,b): if (a == 0): return b else: return mystery(a-1, b+1) 5 Programs for $800
What the mystery function does: def mystery(a,b): if (a == 0): return b else: return mystery(a-1, b+1) Programs for $1000 Sum a and b.
Five immutable data types. Data types for $200 int, float, string, bool, tuple
myList = [True,34, [5,6],”test”] An expression that accesses the number six (6) from the list(s) above. Data types for $400 myList[2][1]
How to change myStr = “Jay” To myStr = “jay” Data types for $600 myStr = ‘j’ + myStr[1:]
A = [5,6,7,8] B = A B[3] = B[2]+3 The value of A[3] 10 Data types for $800
r = “Python is Great!” The result of: r[2]+r[12]+r[8]+r[14]+r[15] Data types for $1000 test!
This return value means that a function did not return a specific value. Potpourri for $200 None, (of type NoneType)
These are the three types of sensors on the Lancet Fluke. Potpourri for $400 IR Obstacle sensors (getObstacle), the camera (takePicture, getBright), and the battery voltage (getBattery) sensor.
Arithmetic operators (like +, -, *, /) have _____ precedence than logical operators (like or, and, not) so arithmetic is done _____. Potpourri for $600 Higher/greater, first
Rewrite the following code using a for loop. x = 7 while (x > 3): print x x = x -1 for x in range(7,3,-1): print x Potpourri for $800
This is the sorting algorithm that Donald Knuth credits John von Neumann with inventing. Potpourri for $1000 Merge Sort