Computer Science
What are the various ways of creating a list?
Python List Manipulation
5 Likes
Answer
The various ways of creating a list are :
- Using Square Brackets [].
- Using the list() constructor.
- Using list comprehensions.
- Appending Elements.
- Using the extend() method.
- Using slicing.
Answered By
2 Likes
Related Questions
Write the output of the following:
for x in range(10, 20): if (x % 2 == 0): continue print(x)
Write the output of the following program on execution if x = 50:
if x > 10: if x > 25: print("ok") if x > 60: print("good") elif x > 40: print("average") else: print("no output")
What are the similarities between strings and lists?
Why are lists called a mutable data type?