32. Marks of these students “Suniti”, “Ryna” and "zeba" in these subjects are available in following these dictionaries respectively:
dl= {1:40, 2:70, 3:70}
d2= {1:40, 2:50, 3:60}
d3= {1:70, 2:80, 3:90}
write down the códe for the following
i)
How to see the key.
ii) How to see the value.
Answers
We're given the following dictionaries, that represent the marks of 3 subjects of 3 students, Suniti, Ryna and Zeba.
d1 = {1:40, 2:70, 3:70}
d2 = {1:10, 2:50, 3:60}
d3 = {1:70, 2:80, 3:90}
(i) Python has an in-built method that enables us to see the keys in the dictionary. This is called the keys() method.
- d1.keys()
- d2.keys
- d3.keys()
These statements will return the keys of each dictionary in the form of a list.
Their output [respectively] would be:
- dict_keys([1, 2, 3])
- dict_keys([1, 2, 3])
- dict_keys([1, 2, 3])
(ii) Again, for this, Python has its own in-built method that enables us to see the values of a dictionary. This is called the values() method.
- d1.values()
- d2.values()
- d3.values()
Like the keys() method, these statements will also return the values in the form of a list.
Their output [respectively] would be:
- dict_values([40, 70, 70])
- dict_values([10, 50, 60])
- dict_values([70, 80, 90])
Answer:
We're given the following dictionaries, that represent the marks of 3 subjects of 3 students, Suniti, Ryna and Zeba.
d1 = {1:40, 2:70, 3:70}
d2 = {1:10, 2:50, 3:60}
d3 = {1:70, 2:80, 3:90}
(i) Python has an in-built method that enables us to see the keys in the dictionary. This is called the keys() method.
d1.keys()
d2.keys
d3.keys()
These statements will return the keys of each dictionary in the form of a list.
Their output [respectively] would be:
dict_keys([1, 2, 3])
dict_keys([1, 2, 3])
dict_keys([1, 2, 3])
(ii) Again, for this, Python has its own in-built method that enables us to see the values of a dictionary. This is called the values() method.
d1.values()
d2.values()
d3.values()
Like the keys() method, these statements will also return the values in the form of a list.
Their output [respectively] would be:
dict_values([40, 70, 70])
dict_values([10, 50, 60])
dict_values([70, 80, 90])
Explanation:
Nastuu it seems like our ans are getting deleted just give me any One Of Your S.O.C.I.A.L M.E.D.I.A and Give those like how I Gave this answer to you Ans very very Long like meh and Do Ans me.. . . . . . . . . . missing uh Yaar!