Computer Science, asked by gouthamsv05, 5 months ago

write a method to perform the following get all the keys in the dictionary​

Answers

Answered by tiwarishashwat125
1

Answer:

You can access the items of a dictionary by referring to its key name, inside square brackets:

Get the value of the "model" key: ...

Get the value of the "model" key: ...

Print all key names in the dictionary, one by one: ...

Print all values in the dictionary, one by one:

Answered by neetutiwari2222
0

Answer:

Python Dictionary | keys() method

Dictionary in Python is an unordered collection of data values, used to store data values like a map, which unlike other Data Types that hold only single value as an element, Dictionary holds key : value pair.

keys() method in Python Dictionary, returns a view object that displays a list of all the keys in the dictionary.

Syntax: dict.keys()

Parameters: There are no parameters.

Returns: A view object is returned that displays all the keys. This view object changes according to the changes in the dictionary.

Example #1:

# Python program to show working

# of keys in Dictionary

# Dictionary with three keys

Dictionary1 = {'A': 'Geeks', 'B': 'For', 'C': 'Geeks'}

# Printing keys of dictionary

print(Dictionary1.keys())

# Creating empty Dictionary

empty_Dict1 = {}

# Printing keys of Empty Dictionary

print(empty_Dict1.keys())

Similar questions