Q: Suppose list1 is [1, 3, 2], What is list1 * 2?
Solution: Execute in the shell and verify.
Q: Suppose list1 = [0.5 * x for x in range(0, 4)], list1 is:
Solution: Execute in the shell to verify.
Q: What will be the output of the following Python code? >>>list1 = [11, 2, 23] >>>list2 = [11, 2, 2] >>>list1 < list2
Solution: Elements are compared one by one.
Q: To add a new element to a list we use which command?
Solution: We use the function append to add an element to the list.
Q: To insert 5 to the third position in list1, we use which command?
Solution: Execute in the shell to verify.
Q: To remove string “hello” from list1, we use which command?
Solution: Execute in the shell to verify.
Q: Suppose list1 is [3, 4, 5, 20, 5], what is list1.index(5)?
Solution: Execute help(list.index) to get details.
Q: Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1.count(5)?
Solution: Execute in the shell to verify.
You Have Score    | /8 |