Answers for "list in python"

5

list in python

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

list in python

# List 
a = []
# Dictionary
b = {}
# Tuple
c = ()
# Set
d = {1,2,3}
Posted by: Guest on August-07-2021
1

list in python

fruits = ["apple", "banana", "cherry"]
print(fruits)

fruits[0]
fruits[:2]
Posted by: Guest on June-30-2021
12

list in python

thislist = ["apple", "banana", "cherry"]
print(thislist[1])
Posted by: Guest on January-07-2020
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

list in python

list = [132, 31212, 12, 2, 12]
print(list[3])
#output: 2
Posted by: Guest on May-25-2021
1

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

list = [0,1,2,3,4]     
print("printing original list: ");    
for i in list:    
    print(i,end=" ")    
list.remove(2)    
print("\nprinting the list after the removal of first element...")    
for i in list:    
    print(i,end=" ")
Posted by: Guest on May-25-2021
1

list in python

list = []
Posted by: Guest on April-16-2021

Python Answers by Framework

Browse Popular Code Answers by Language