
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

# ObjectsvsDictionaries.py
# Define the class Name class Name: def init(self): self.firstname = "[no first name]" self.lastname = "[no last name]"
# Define dictionaries with keys firstname and lastname myNameDict = {"firstname" : "David", "lastname" : "Joyner"}
# Define instances of Name myNameInst = Name() myNameInst.firstname = "David" myNameInst.lastname = "Joyner"
print("Dictionary: " + myNameDict["firstname"]) print("Instance: " + myNameInst.firstname)