-2
people = {"a":0, "b": 0, "c": 0, "d": 0}

def changes(option):
    if option == 1:
        person = input("Who would you like to add points to? ")
        print(person)
        amount = input("How many points would you like to add to " + str(person) + "?")
        people[person] += amount
        print("SUCCESSFULLY UPDATED: " + person + " now has " + str(people.person) + " points")
mkrieger1
  • 19,194
  • 5
  • 54
  • 65

2 Answers2

0

Replace str(people.person) with people[person] Because you are trying to access people['person'] otherwise.

Timothy Alexis Vass
  • 2,526
  • 2
  • 11
  • 30
0

person is not a key, It's a variable that holds the key.

This will work:

people = {"a":0, "b": 0, "c": 0, "d": 0}

def changes(option):
    if option == 1:
        person = input("Who would you like to add points to? ")
        print(person)
        amount = int(input("How many points would you like to add to " + str(person) + "?"))
        people[person] +=   amount
        print("SUCCESSFULLY UPDATED: " + person + " now has " + str(people[person]) + " points")
 
        
changes(1)
Abhi
  • 995
  • 1
  • 8
  • 12