Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Aisha Lesson 2
# Lesson 2 - OBJECT ORIENTED PROGRAMMING CLASSES class Student: # first thing ALWAYS - constructor def __init__(self, first, last): self.first = first self.last = last self.email = self.first + self.last + '@email.com' class Member: def __init__ (self, first, last): self.first = first self.last = last self.email = self.first + self.last + '@email.com' std1 = Student('Aisha', 'Al-Qahtani') mem_1 = Member('Ahmed', 'Jassim') # OOP In Python # name of class ----> class Member: # an instance of class ----> mem_1 = Member(...) # constructor of class ----> def __init__(self, ...) # attributes of class ----> self.first, self.last, self.email # Assignment - Create a class called Fraction where the constructor # stores the attributes numerator and denominator # myFrac = Fraction(14, 17)
run
|
edit
|
history
|
help
0
Python regex to find repetitive word count
gameboy
My Temp Converter
Manual
Gani
rstring
NormalizeTags
ab.py
NormalizedTags
Reed Solomon error correction