Informatics Practices
Select the output of the following expression:
str1 = "pen"
print(list(str1))
- ['p', 'e', 'n' ]
- [pen]
- [p/e/n]
- { "pen" }
Related Questions
Which of the following commands will create a list?
- List1=list ()
- List1= []
- List1=[1,2,3,"a"]
- All of these
What is the use of append() function in list?
- It adds an item to the end of the list.
- It adds an item at the beginning of the list.
- It adds an item anywhere in the list.
- All of these
The sequential accessing of each of the elements in a list is called:
- List Indexing
- List Traversal
- List Slicing
- List Accessing
Consider the following lists:
L1 = ["this", "is", "a", "list"] L2 = ["this", "is", "another list"]Which of the following statements will result in an error?
- L1 = L2
- L1.copy()
- L2.append(1, 2, 3)
- L2.pop()