Python exam review-Questions and Answers Graded A+
Python exam review-Questions and Answers Graded A+ how do we add a list to a list? - ANSWER-list[2] = [1, 2, 3] how do we ad elements of a list to a list? - ANSWER-list[2:2] = [1,2,3] how do we delete elements from a list? - ANSWER-del list[1] what's another way of deleting elements from a list, besides del? - ANSWER-list[1] = [] what does 3 * [0] return? - ANSWER-[0,0,0] if you really want to copy a list, what can you do? - ANSWER-list2 = list1[:] difference between append and extend? - ANSWER-append adds whole argument as single element, while extend adds each item of argument as element how to insert exactly one element? - ANSWER-t(position, element) what does remove do to a list? - ANSWER-removes first element in list with given value what does () do? - ANSWER- what does () do? - ANSWER- what does () do? - ANSWER- what does (key) return if the key exists? - ANSWER-the value of the key what does (key) return if the key does not exist? - ANSWER-None what kind of objects do dictionary methods return? - ANSWER-view what are the three dictionary methods? - ANSWER-keys(), values(), items() what is the advantage of returning dictionary methods as view objects rather than as lists? - ANSWER-thye are dynamic and reflect changes to the dictionary define list - ANSWER-collection of different objects indexed by numbers what is the big difference between strings and lists? - ANSWER-strings are immutable, lists are mutable
Written for
- Institution
- Python programming
- Course
- Python programming
Document information
- Uploaded on
- March 28, 2024
- Number of pages
- 9
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
- the value of the key
- match object
-
python exam review questions and answers graded a
-
difference between strings and lists
-
ways of creating strings from text
-
ways to make multiline strings
Also available in package deal