Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views

Programming in Python - - Unit 8 - Week 8 (Contents)_ Introduction to dictionaries

The document outlines the content and assessments for a Python programming course, specifically focusing on dictionaries in Week 8. It includes questions and answers related to creating, accessing, modifying, and deleting dictionary elements in Python. The assignment was due on April 7, 2024, and students were allowed to submit it only once.

Uploaded by

rvseceprint
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Programming in Python - - Unit 8 - Week 8 (Contents)_ Introduction to dictionaries

The document outlines the content and assessments for a Python programming course, specifically focusing on dictionaries in Week 8. It includes questions and answers related to creating, accessing, modifying, and deleting dictionary elements in Python. The assignment was due on April 7, 2024, and students were allowed to submit it only once.

Uploaded by

rvseceprint
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

4/23/24, 2:15 AM 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 

CEC (https://swayam.gov.in/explorer?ncCode=CEC) » Programming in Python (course)

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

Week 2 A sequence of ordered elements


(Contents): A collection of key-value pairs
Techniques
A mutable list
of Problem
Solving () A data type for storing numbers
Yes, the answer is correct.
Week 3 Score: 1
(Contents): Accepted Answers:
Introduction A collection of key-value pairs
to Python ()
2) How do you create an empty dictionary in Python? 1 point
Week 4
(Contents): dict()
Conditional {}
Statements Dict
and Looping
()
Empty_dict()
Yes, the answer is correct.
Week 5 Score: 1
(Contents): Accepted Answers:
String {}
Manipulation
() 3) What is the output of the following code? 1 point
a = {"akash":20, "arun":20}

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

Week 9 7) How do you delete an element from a dictionary in Python? 1 point


(Contents):
Python dictionary.delete(key)
Functions () del dictionary[key]
dictionary.remove(key)

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

Week 10 dictionary[key] = None


(Contents) : Yes, the answer is correct.
Python Score: 1
Modules () Accepted Answers:
del dictionary[key]
Week 11 8)How do you get the value associated with a key in a dictionary in 1 point
(Contents):
Python?
Input-Output
() dictionary.get(key)
dictionary[key]
Week 12
(Contents): dictionary.value(key)
Exception dictionary.values()[key]
Handling ()
Yes, the answer is correct.
Score: 1
Accepted Answers:
dictionary.get(key)

9) How do you remove a key-value pair from a dictionary in Python? 1 point

By using the remove() method


By using the delete() method
By using the pop() method
By using the clear() method
Yes, the answer is correct.
Score: 1
Accepted Answers:
By using the pop() method

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

You might also like