Answers for "list in pyhton"

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
5

lists in python

lst = ["abc", 34, True, 40, "male"]
for i in lst:
	print(i)
Posted by: Guest on March-17-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
0

list in python

list = [1, 2, 3, 4, 5, 6]     
print(list)     
# It will assign value to the value to second index   
list[2] = 10   
print(list)    
# Adding multiple element   
list[1:3] = [89, 78]     
print(list)   
# It will add value at the end of the list  
list[-1] = 25  
print(list)
Posted by: Guest on May-25-2021
0

how to use list in python

seller = ['apple', 'banana', 'avocado'] # the list
new_item = 'kiwi' # new item in the store
seller.append(new_item) # now it's have been added to the list
Posted by: Guest on June-04-2021

Python Answers by Framework

Browse Popular Code Answers by Language