Skip to content

Instantly share code, notes, and snippets.

@gergob
Created November 21, 2014 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gergob/24b054229a9dc25e9686 to your computer and use it in GitHub Desktop.
Save gergob/24b054229a9dc25e9686 to your computer and use it in GitHub Desktop.
Gadget class with constructor
class Gadget:
weight = 100
operating_system = None
battery_capacity = 2000
screen_size = 1
def __init__(self, weight, operating_system, battery_capacity, screen_size):
self.weight = weight
self.operating_system = operating_system
self.battery_capacity = battery_capacity
self.screen_size = screen_size
my_iphone = Gadget(weight = 128, operating_system="iOS", battery_capacity=2800, screen_size=4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment