Skip to content

Instantly share code, notes, and snippets.

@axayjha
Created July 3, 2017 16:40
Show Gist options
  • Save axayjha/2a7409a3d198cd5d1f03d2cfb81a2f66 to your computer and use it in GitHub Desktop.
Save axayjha/2a7409a3d198cd5d1f03d2cfb81a2f66 to your computer and use it in GitHub Desktop.
employee = {}
employee["Name"] = ("Akshay","Anand", "Jha")
employee["Address"] = ["36C", "DH Road", "Kolkata"]
employee["Contact"] = {"number": "+91-9483873647", "email": "[email protected]"}
employee["Job"] = "Developer"
employee["Salary"] = 50000
# 1
for i, j in employee.items():
print(str(i) + " : " + str(j))
print("")
# 2
print(employee["Name"][0] + " " + employee["Name"][1] + " " + employee["Name"][2])
print("")
# 3
print(employee["Name"][2] + " " + employee["Name"][0])
print("")
# 4
employee["Contact"]["email"] = employee["Contact"]["email"][:4]+ "def" + employee["Contact"]["email"][-4:]
print(employee["Contact"]["email"])
print("")
# 5
print(employee["Address"][1])
print("")
# 6
print(employee["Contact"]["number"].partition("-")[0])
print("")
# 7
print(employee["Address"][0])
print("")
# 8
length=0
for i in employee.items():
length+=1
print(length)
print("")
# 9
employee["Job"] = "Software " + employee["Job"]
print(employee["Job"])
print("")
# 10
employee["Age"] = 25
print("Age = " + str(employee["Age"]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment