• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 14 pages
Exam (elaborations)

Python Review Practice Study Test.

Document preview thumbnail
Preview 2 out of 14 pages

Python Review Practice Study Test. how do we add a list to a list? - CORRECT ANSWER list[2] = [1, 2, 3] how do we ad elements of a list to a list? - CORRECT ANSWER list[2:2] = [1,2,3] how do we delete elements from a list? - CORRECT ANSWER del list[1] what's another way of deleting elements from a list, besides del? - CORRECT ANSWER list[1] = [] what does 3 * [0] return? - CORRECT ANSWER [0,0,0] if you really want to copy a list, what can you do? - CORRECT ANSWER list2 = list1[:] difference between append and extend? - CORRECT ANSWER append adds whole argument as single element, while extend adds each item of argument as element how to insert exactly one element? - CORRECT ANSWER t(position, element) what does remove do to a list? - CORRECT ANSWER removes first element in list with given value what does () do? - CORRECT ANSWER what does () do? - CORRECT ANSWER what does () do? - CORRECT ANSWER what does (key) return if the key exists? - CORRECT ANSWER the value of the key what does (key) return if the key does not exist? - CORRECT ANSWER None what kind of objects do dictionary methods return? - CORRECT ANSWER view what are the three dictionary methods? - CORRECT ANSWER keys(), values(), items() what is the advantage of returning dictionary methods as view objects rather than as lists? - CORRECT ANSWER thye are dynamic and reflect changes to the dictionary define list - CORRECT ANSWER collection of different objects indexed by numbers what is the big difference between strings and lists? - CORRECT ANSWER strings are immutable, lists are mutable what is the difference between list[2] = [1,2,3] and list[2:2] = [1,2,3]? - CORRECT ANSWER [2] adds as list, [2:2] adds as separate elements how many elements does list[2:3] represent? - CORRECT ANSWER one where does a slice end? - CORRECT ANSWER right before the second index of the slice how do you remove element three from a list by slicing? - CORRECT ANSWER list[2:3] = [] is len a function or a method? - CORRECT ANSWER function how to find the length of a list? - CORRECT ANSWER len(list) what do we have to know about the operands of list operators? - CORRECT ANSWER both must be lists how to determine whether a value is an element of list? - CORRECT ANSWER element in list what does in do? - CORRECT ANSWER determines whether element is in list what does in operator return if element is fond? - CORRECT ANSWER TRUE what does in return if element is not found? - CORRECT ANSWER FALSE how do you return an entire list by slicing? - CORRECT ANSWER list[:] how do you reverse the order of elements of a list in place? - CORRECT ANSWER se() what are two situations for which tuples can be used but lists cannot? - CORRECT ANSWER % formatting, dictionary keys how do you get a dictionary value - CORRECT ANSWER dict[key] what are strings? - CORRECT ANSWER collection of characters that are stored together what do strings represent? - CORRECT ANSWER arbitrary text what are three ways of creating strings from text? - CORRECT ANSWER single, double, triple quotes what are two ways to make multiline strings? - CORRECT ANSWER triple quotes, backslash backspace - CORRECT ANSWER b horizontal tab - CORRECT ANSWER t

Content preview

Python Review Practice Study Test.

how do we add a list to a list? - CORRECT ANSWER list[2] = [1, 2, 3]



how do we ad elements of a list to a list? - CORRECT ANSWER list[2:2] = [1,2,3]



how do we delete elements from a list? - CORRECT ANSWER del list[1]



what's another way of deleting elements from a list, besides del? - CORRECT ANSWER list[1] = []



what does 3 * [0] return? - CORRECT ANSWER [0,0,0]



if you really want to copy a list, what can you do? - CORRECT ANSWER list2 = list1[:]



difference between append and extend? - CORRECT ANSWER append adds whole argument as single
element, while extend adds each item of argument as element



how to insert exactly one element? - CORRECT ANSWER list.insert(position, element)



what does remove do to a list? - CORRECT ANSWER removes first element in list with given value



what does list.sort() do? - CORRECT ANSWER



what does list.index() do? - CORRECT ANSWER



what does list.count() do? - CORRECT ANSWER



what does dict.get(key) return if the key exists? - CORRECT ANSWER the value of the key

, what does dict.get(key) return if the key does not exist? - CORRECT ANSWER None



what kind of objects do dictionary methods return? - CORRECT ANSWER view



what are the three dictionary methods? - CORRECT ANSWER keys(), values(), items()



what is the advantage of returning dictionary methods as view objects rather than as lists? - CORRECT
ANSWER thye are dynamic and reflect changes to the dictionary



define list - CORRECT ANSWER collection of different objects indexed by numbers



what is the big difference between strings and lists? - CORRECT ANSWER strings are immutable, lists are
mutable



what is the difference between list[2] = [1,2,3] and list[2:2] = [1,2,3]? - CORRECT ANSWER [2] adds as
list, [2:2] adds as separate elements



how many elements does list[2:3] represent? - CORRECT ANSWER one



where does a slice end? - CORRECT ANSWER right before the second index of the slice



how do you remove element three from a list by slicing? - CORRECT ANSWER list[2:3] = []



is len a function or a method? - CORRECT ANSWER function



how to find the length of a list? - CORRECT ANSWER len(list)



what do we have to know about the operands of list operators? - CORRECT ANSWER both must be lists

Document information

Uploaded on
April 5, 2025
Number of pages
14
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$12.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
ROSEGRADES
3.4
(35)
Sold
236
Followers
87
Items
12121
Last sold
3 weeks ago




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions