Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
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
Please
log in
to post a comment.
problem rstring
Aufgabe 16
project euler 16
Parity in Python
TIC TAC TOW.py
daily score
Problem: on_off
Filter dictionaries with specific keys (using list comprehension)
Pattern
Problem: rstring
Please log in to post a comment.