Among Us Voting System: HALP AGAIN
Smart0ne (725)


Let's say I have the following code:

votes = {"red":2,"yellow":1,"green":0,"cyan":2,"blue":1,"magenta":0}

It's a dictionary named "votes". Now I want a function that can return the key names of the values that have the maximum value. If this is unclear, the function should return

ejected = ["red","cyan"]

since "red" and "cyan" have the biggest values in the dictionary. Can someone help me implement this?

Thanks in advance!

You are viewing a single comment. View All
Smart0ne (725)

@heyitsmarcus Hm ... after trying your code, I get a "TypeError: 'dict' object not callable".

Also, my code is

  print("\nWho do you vote for?")
  for i in range(len(colours)):
    print("{} - {}".format(i+1,colours[i]))
  while True:
    voting = input("---> ")
    if voting == "1" or voting == "2" or voting == "3" or voting == "4" or voting == "5" or voting == "6" :
      vote_number[vote_number_lookup(voting)] += 1
      print("Please enter the NUMBER corresponding to the person you want to vote off.")