Skip to content

Instantly share code, notes, and snippets.

@nutchy
Last active October 25, 2018 08:09
Show Gist options
  • Save nutchy/74d25a6e69e10c6ac39d90bcfd1baa28 to your computer and use it in GitHub Desktop.
Save nutchy/74d25a6e69e10c6ac39d90bcfd1baa28 to your computer and use it in GitHub Desktop.
""" Finding Card """
def cardAt(num):
"""
This function will return card at position num
Example :
==========================
| Input | Output |
==========================
| 0 | 2C |
| 1 | 3C |
| 34 | 0H |
==========================
"""
# Declaration rank and suit of face card
suit = "CDHS"
ranking = "234567890JQKA"
return ranking[num%13] + suit[num//13]
print(cardAt(int(input('Input a number : '))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment