Final Exam Flashcards
(10 cards)
1
Q
Difference between list and string
A
lists: hold values of any type
strings: sequence of characters
2
Q
variable[3]
A
the value in index 3
3
Q
[0,3]
A
values from index 0 to 2
4
Q
if “value” in list
A
in looks for it in the list
5
Q
states.pop(3)
A
removes value in index 3 from list
6
Q
states.pop( )
A
removes last value in list
7
Q
list.insert (0, value)
A
inserts value into given index, moves everything else down
8
Q
variable[0]= value
A
replaces index 0 with given value
9
Q
what range of numbers are generated by random ( )
A
greater than equal to zero and less than one
10
Q
A