Skip to content

Instantly share code, notes, and snippets.

@p0rsche
Last active August 19, 2020 07:12
Show Gist options
  • Save p0rsche/774ab8a25e0d0ffe09c743cc7c429bfc to your computer and use it in GitHub Desktop.
Save p0rsche/774ab8a25e0d0ffe09c743cc7c429bfc to your computer and use it in GitHub Desktop.
Operations with dictionary - All hands on deck
faced_cards = {'Jack': 11, 'Queen': 12, 'King': 13, 'Ace': 14}
cards_in_hand = [int(x) if faced_cards.get(x) is None else faced_cards.get(x) for x in [input() for _ in range(6)]]
print(sum(cards_in_hand)/len(cards_in_hand))
# Sample Input 1:
#
# Ace
# 4
# 9
# Jack
# 10
# 7
# Sample Output 1:
#
# 9.166666666666666
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment