Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Created September 19, 2018 13:43
Show Gist options
  • Save azamsharp/3b6fb954f7e14fc7c60f72028510b111 to your computer and use it in GitHub Desktop.
Save azamsharp/3b6fb954f7e14fc7c60f72028510b111 to your computer and use it in GitHub Desktop.
# customer dictionary with address and geo as additional
# dictionaries inside it
customer = {"firstName":"John","lastName":"Doe",
"address":{"street":"1200 Richmond","state":"TX","zipCode":"77066","geo":{
"latitude":123, "longitude":123.122
}}
}
new_customer = {
"firstName":"Steven",
"lastName":"Doe",
"address":{}
}
first_name = customer["firstName"]
print(first_name)
address = customer["address"]
address["city"] = "Austin"
print(address["city"])
airports = {"IAH":"Intercontinental Airport", "SEATAC":"Seattle Airport"}
for key in airports:
print(airports[key])
airports["IAH"] = "George Bush Airport"
print(airports)
# zillow listing example
print("Zillow Listings")
listing1 = {
"city":"Houston",
"noOfRooms": 5,
"state":"TX"
}
listing2 = {
"city":"Austin",
"noOfRooms": 3,
"state":"TX"
}
listings = [listing1,listing2]
print("printing the listings")
#for index in range(0,len(listings)):
# print(listings[index])
for l in listings:
print(l)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment