Basic Programs

If Else Programs

While loop Programs

For loop Programs

List Programs

Dict Programs


Python program to Add New item in dictionary


In this example shows, method shows the how to add one or more items to the dictionary.

Example.py
details = {
  "Name": "Kumaran",
  "Std": "8th",
  "Roll No": 35,
  "Section": "A"
}
details["Gender"] = "Male"
details["Mobile"] = 8723667657
print(details)

Output

{'Name': 'Kumaran', 'Std': '8th', 'Roll No': 35, 'Section': 'A', 'Gender': 'Male', 'Mobile': 8723667657}

Prev Next