English

Assuming that D1 is a dictionary in Python. Write a Python expression to check if the key, ‘RNo’ is present in D1. - Computer Science (Python)

Advertisements
Advertisements

Question

Assuming that D1 is a dictionary in Python.

Write a Python expression to check if the key, ‘RNo’ is present in D1.

Very Short Answer
Advertisements

Solution

'RNo' in D1

This expression returns True if the key is present in the dictionary and False otherwise. It is the most efficient and standard way to verify the existence of a key in Python.

shaalaa.com
  Is there an error in this question or solution?

APPEARS IN

Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×