Programming in Python - - Unit 8 - Week 8 (Contents)_ Introduction to dictionaries
Programming in Python - - Unit 8 - Week 8 (Contents)_ Introduction to dictionaries
(https://swayam.gov.in) (https://swayam.gov.in/nc_details/CEC)
mathavi.2007@gmail.com
Course Assessment-8-2024
outline The due date for submitting this assignment has passed.
Due on 2024-04-07, 23:59 IST.
Week 1 Score: 9/10=90%
(Contents) :
Planning the
Computer Assignment submitted on 2024-03-30, 13:58 IST
Program () 1) What is a dictionary in Python? 1 point
https://onlinecourses.swayam2.ac.in/cec24_cs01/unit?unit=44&assessment=99 1/3
4/23/24, 2:15 AM Programming in Python - - Unit 8 - Week 8 (Contents): Introduction to dictionaries
b = {"bikash":60, "bivek":45}
Week 6
print(a == b)
(Contents):
Introduction True
to list. ()
False
Week 7 No, the answer is incorrect.
(Content): Score: 0
Introduction Accepted Answers:
to tuples. () False
4) How do you add an element to a dictionary in Python? 1 point
Week 8
(Contents): dictionary[key] = value
Introduction dictionary.append(key, value)
to
dictionary.add(key, value)
dictionaries
() dictionary[key] = dictionary[key] + value
Yes, the answer is correct.
Lecture 1: Score: 1
Introduction to Accepted Answers:
dictionaries
dictionary[key] = value
(unit?
unit=44&lesso
5) What will be the output of the following code? 1 point
n=45)
my_dict = {"a": 3, "b": 2, "c": 1, "d":4}
Lecture 2: print(len(my_dict))
Accessing
values in 1
dictionaries
2
(unit?
unit=44&lesso 3
n=46) 4
Lecture 3: Yes, the answer is correct.
Working with Score: 1
dictionaries Accepted Answers:
(unit? 4
unit=44&lesso
n=47) 6) What will be the output of the following code? 1 point
Lecture my_dict = {"apple": 3, "mango": 2, "orange": 1}
Material (unit? print(my_dict.get("grape", 0))
unit=44&lesso
n=48) 0
1
Quiz:
Assessment- Yes, the answer is correct.
8-2024 Score: 1
(assessment? Accepted Answers:
name=99) 0
https://onlinecourses.swayam2.ac.in/cec24_cs01/unit?unit=44&assessment=99 2/3
4/23/24, 2:15 AM Programming in Python - - Unit 8 - Week 8 (Contents): Introduction to dictionaries
10) How do you iterate over the key-value pairs in a dictionary in 1 point
Python?
for key, value in dictionary
for key, value in dictionary.items()
for key, value in dictionary.iteritems()
for key, value in dictionary()
Yes, the answer is correct.
Score: 1
Accepted Answers:
for key, value in dictionary.items()
You were allowed to submit this assignment only once.
https://onlinecourses.swayam2.ac.in/cec24_cs01/unit?unit=44&assessment=99 3/3