Question:

Identify the invalid Python statement from the following:

Show Hint

To initialize an empty dictionary, use dict()} or \{\}}. Avoid mixing the two syntax forms.
Updated On: Jan 21, 2025
  • d = dict()
     

  • e = {}
     

  • f = [] 
     

  • g = dict{} 
     

Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is D

Solution and Explanation

The statement g = dict{} is invalid because the dict() function should not include curly braces {} as an argument. The correct way to initialize an empty dictionary is g = dict() or g = {}. All other options correctly initialize dictionaries or lists.

Was this answer helpful?
0
0

Top Questions on Commands and Requests

View More Questions