Deck Of Cards – Python Script

GitHub Full script

What this script covers

  • import module to use random library
    • randint (for randomised integers)
  • 3 main functions
    • Card (suit and value defined)
    • Deck (organised and shuffled, suits named and range specified)
    • Player (draws card – this can be adapted for different card selection styles, last card as default)
  • class – (class is a set or category of things having some property or attribute in common)
  • object – (object is one of instances of the class which can perform the functionalities which are defined in the class)
  • self – (this method allows access to attributes and methods of the class in Python)
  • __init__ – (reserved method in Python classes. It is known as a constructor in object oriented concepts. Allows the class to initialise the attributes of a class)
  • range
  • list (create empty and append throughout script)
  • variables
  • unsplash : jaroslaw kwoczala
  • deck of cards

Any Thoughts?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s