Which of the following syntaxes is used to define an empty dictionary in Python?
- empty_dict = ()
- empty_dict = []
- empty_dict = {}
- empty_dict = {}{}
The correct syntax to define an empty dictionary in Python is 'empty_dict = {}'. An empty dictionary consists of a pair of curly braces with nothing inside.
Loading...
Related Quiz
- In which scenario would the @classmethod decorator be more appropriate than @staticmethod?
- What does the as keyword do in the context of importing modules in Python?
- In Python, the ____ statement can be used to assert that a certain expression is true, typically used for debugging purposes.
- What mode should you open a file in to write to it without deleting its existing content?
- The while loop continues execution as long as the test expression remains _______.