Skip to content

Instantly share code, notes, and snippets.

@vinicius5581
Created February 21, 2019 03:47
Show Gist options
  • Save vinicius5581/a65430da6fa39ce6132748da877e1c86 to your computer and use it in GitHub Desktop.
Save vinicius5581/a65430da6fa39ce6132748da877e1c86 to your computer and use it in GitHub Desktop.
Helping Anastasia with her Python journey
# def sum(a, b):
# return a + b
# print(1 + 2)
# print(1 + 3)
# print(sum(1, 2))
class Computer:
website = "www.apple2.com"
def __init__(self, owner):
self.computerOwner = owner
@classmethod
def getAddress(cls):
return cls.website
@staticmethod
def printAny(value):
print("Factory name: " + value)
def getOwner(self):
return self.computerOwner
def setOwner(self, value):
self.computerOwner = value
# print(Computer.getAddress())
# Computer.printAny(Computer.getAddress())
comp1 = Computer('Vini')
comp2 = Computer('Vini')
print(comp1.computerOwner == comp2.computerOwner)
print(id(comp1))
# print(comp1.computerOwner)
# comp1.computerOwner = "Jhon lenon"
# print(comp1.computerOwner)
# Computer.setOwner(comp1, 'Ringo Star')
# Computer.printAny(comp1.getOwner())
# Computer.printAny("bro")
# print(comp1.getOwner())
# print(comp2.getOwner())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment