May 15, 2019 in Python
Q: Dictionary could be copied to another dictionary using which of following syntax?

dict_a = dict_b

dict_a = dict_b.clear()

dict_a=dict_b.copy()

dict_a = copy(dict_b)

1 Answer

0 votes
Aug 27, 2019

They copy() statement or method in Python returns a copy of the dictionary.

Syntax of Copy() in Python is as follows:

dict_a=dict_b.copy()

Or

dict.copy()

Parameters:

The copy() method don't have any parameters.

Returns:

This method doesn't modify the original dictionary instead it just returns copy of the dictionary.

Related questions

0 votes
Jul 2, 2020 in Python
0 votes
Jun 30, 2020 in Python
...