Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. class Character():
  2.   def __init__(self, name):
  3.      self.name = name
  4.      self.affection = 1
  5.  
  6. sam = Character("Sam")
  7. lulu = Character("Lulu")
  8.  
  9. npc_dictionary = {"Sam": sam, "Lulu": lulu}
  10.  
  11. print(npc_dictionary["Sam"].affection) # prints 1
  12. npc_dictionary["Sam"].affection = 10
  13.  
  14. print(npc_dictionary["Sam"].affection) # prints 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement