Q. What is the correct syntax to check if a key exists in a dictionary?

यह जांचने के लिए सही वाक्यविन्यास क्या है कि शब्दकोश में कोई कुंजी मौजूद है या नहीं?

A
if key in dict:
B
if dict.has_key(key):
C
if key in dict.keys():
D
if dict.contains(key):

Explanation

Explanation will be available soon. Please stay tuned.

व्याख्या जल्द ही उपलब्ध होगी। कृपया बने रहें।

Invest in Future Achievers

Your support helps keep Exam Achiever 100% free for students preparing for exams.

Thanks for your support!

Comments

Leave a Comment