Answers for "list.items python"

12

python lists

thislist = ["apple", "banana", "cherry"]
print(thislist[1])
Posted by: Guest on January-07-2020
6

python list

#Creating lists
my_list = [1, "Hello", 3.4, 0, "World"]
my_nested_list = [['Hello', 'World'],[47,39]]

#Accessing lists
my_list[1] # Hello
my_list[-2] # 0
my_list[:3] # [1, "Hello", 3.4]
my_nested_list[1] #[47,39]
my_nested_list[0][1] # World
Posted by: Guest on May-21-2020
2

python dlist

#this is how  to create a list:
#I named it mylist, but you can name it whatever you like

myList = [1,2,3,4,5]
print(myList[0]) # this will print the first element of the list
print(myList[1]) #this will print the second element of the list
print(myList[2])#and so on
print(myList[3])
print(myList[4])
Posted by: Guest on April-08-2020
-1

.items() python

dictionary.items()
Posted by: Guest on February-28-2021
-1

.items() python

The items() method returns a view object. The view object contains the key-value pairs of the dictionary, as tuples in a list. The view object will reflect any changes done to the dictionary,
Posted by: Guest on February-28-2021

Python Answers by Framework

Browse Popular Code Answers by Language