Skip to content

Instantly share code, notes, and snippets.

View timolesterhuis's full-sized avatar
🥋
in training

Timo Lesterhuis timolesterhuis

🥋
in training
  • EY Netherlands
  • Alkmaar
View GitHub Profile
import math # We'll use the math module later in this snippet
class Vector:
"""A 2D vector class with some useful methods"""
def __init__(self, x: float, y: float) -> None:
self.x = x
self.y = y
from typing import Tuple
class Person:
# class attribute
species = "Homo Sapiens"
# Instance attribute
def __init__(self, name: str, age: int) -> None:
self.name = name
self.age = age
# Functional programming is about immutable objects:
name = "John Doe" # string
age = 29 # int
weight = 98.7 # float
# and stateless functions:
def say_hello(to: str) -> None: