Answers for "what is list() in python"

6

list in python

myfavouritefoods = ["Pizza", "burgers" , "chocolate"]
print(myfavouritefoods[1])
#or
print(myfavouritefoods)
Posted by: Guest on January-26-2021
3

list() in pyhton

# list() converts other datatypes into lists

# e.g.

text = 'Python'

# convert string to list
text_list = list(text)
print(text_list)

# check type of text_list
print(type(text_list))

# Output: ['P', 'y', 't', 'h', 'o', 'n']
#         <class 'list'>
Posted by: Guest on September-26-2021
3

list in python

#list is data structure 
#used to store different types of data at same place
list = ['this is str', 12, 12.2, True]
Posted by: Guest on August-25-2020
2

list in python

myList = ["Test", 419]
myList.append(10)
myList.append("my code")
print(myList)
Posted by: Guest on October-06-2020
0

list in python

# Python program to demonstrate 
# Removal of elements in a List
  
# Creating a List
List = [1, 2, 3, 4, 5, 6, 
        7, 8, 9, 10, 11, 12]
print("Intial List: ")
print(List)
  
# Removing elements from List
# using Remove() method
List.remove(5)
List.remove(6)
print("nList after Removal of two elements: ")
print(List)
  
# Removing elements from List
# using iterator method
for i in range(1, 5):
    List.remove(i)
print("nList after Removing a range of elements: ")
print(List)
Posted by: Guest on May-25-2021

Python Answers by Framework

Browse Popular Code Answers by Language