Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- elif choice == "a5":
- print("Provide me with a string in the following form: 'a2b4A5s3B1'. Where letters represent players and numbers score.")
- print("Lower case letters means the player is given more points and upper case letters means the following points are subtracted from the players total.")
- fullstring = input("Give me the string: ")
- players = []
- score = []
- scoreindex = 0
- output = ""
- for character in fullstring:
- if character.isalpha():
- if character.lower() not in players:
- players.append(character.lower())
- if character.islower():
- score.append(fullstring[fullstring.index(character) + 1])
- else:
- score.append(0 - int(fullstring[fullstring.index(character) + 1]))
- else:
- scoreindex = players.index(character.lower())
- if character.islower():
- score[scoreindex] = int(score[scoreindex]) + int(fullstring[fullstring.index(character) + 1])
- else:
- score[scoreindex] = int(score[scoreindex]) - int(fullstring[fullstring.index(character) + 1])
- for i in range(len(players)):
- if output == "":
- output += players[i] + " " + str(score[i])
- else:
- output += ", " + players[i] + " " + str(score[i])
- print("\nMarvin says:\n")
- print(output)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement