Skip to content

Instantly share code, notes, and snippets.

@allatambov
Created March 24, 2020 12:56
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 allatambov/b30992e296513e8d1945ae0a56e26957 to your computer and use it in GitHub Desktop.
Save allatambov/b30992e296513e8d1945ae0a56e26957 to your computer and use it in GitHub Desktop.
import numpy as np
A = np.array([8, 2, 8])
A.dtype
A.ndim
A.sort()
A
class Cauldron:
def __init__(self, size, material):
self.size = size
self.material = material
caul = Cauldron('medium', 'copper')
caul
caul.material
caul.size
class Cauldron:
def __init__(self, size, material, contents=[]):
self.size = size
self.material = material
self.contents = contents
def add(self, x):
self.contents.append(x)
caul = Cauldron('medium', 'copper')
caul.contents
caul.add('ginger')
caul.add('snake fangs')
caul.contents
class Cauldron:
def __init__(self, size, material, contents=[]):
self.size = size
self.material = material
self.contents = contents
def add(self, x):
self.contents.append(x)
def engorgio(self):
self.size = 'huge'
self.contents = [s.upper() for s in self.contents]
caul = Cauldron('medium', 'copper')
caul.add('ginger')
caul.add('snake fangs')
caul.engorgio()
caul.contents
caul.size
class Cauldron:
def __init__(self, size, material, contents=[]):
self.size = size
self.material = material
self.contents = contents
def add(self, x):
self.contents.append(x)
def engorgio(self):
self.size = 'huge'
self.contents = [s.upper() for s in self.contents]
print('Engorgio')
caul = Cauldron('medium', 'copper')
caul.engorgio()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment