Computer Science, asked by shantanugarg99, 5 months ago

Consider the following dictionary:

States= {‘D’: ‘Delhi’, ‘K’: ‘Kerala’, ‘T’: ‘Tamil Nadu’, ‘B’: ‘Bihar’}

Write Python statements for the following:
a) Create the above dictionary.

b) To insert (‘K’: ‘Kanpur’) in the dictionary states.

c) To return the value corresponding to the key ‘T’

d) To return the length of the dictionary states.

e) To delete the dictionary states​

Answers

Answered by jai696
2

\huge\red{\mid{\fbox{\tt{Using\: Python\: 3}}\mid}}

state_keys, state_vals = ["D", "K", "T", "B"], ["Delhi", "Kerala", "Tamil Nadu", "Bihar"]

States = dict(zip(state_keys, state_vals))

States["K"] = "Kanpur"

print(States["T"])

print(f"States len: {len(States)}")

del States

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Answered by Japji21
1

Answer:

state_keys, state_vals = ["D", "K", "T", "B"], ["Delhi", "Kerala", "Tamil Nadu", "Bihar"]

States = dict(zip(state_keys, state_vals))

States["K"] = "Kanpur"

print(States["T"])

print(f"States len: {len(States)}")

del States

Similar questions