This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person: | |
def __init__(self, first, last): | |
self.firstname = first | |
self.lastname = last | |
def name(self): | |
return f'{self.firstname} {self.lastname}' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person: | |
def __init__(self, first, last): | |
self.firstname = first | |
self.lastname = last | |
def name(self): | |
return f'{self.firstname} {self.lastname}' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Animal: | |
def __init__(self, name, species): | |
self.name = name | |
self.species = species | |
def speak(self): | |
return 'blah blah' | |
class Dog(Animal): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Robot: | |
def __init__(self, name, model_no, creator): | |
self.name = name | |
self.model_no = model_no | |
self.creator = creator | |
def walk(self): | |
return 'I am walking using my wheels' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Superclass: | |
def class_names(self): | |
return 'I am super class' | |
class ClassA(Superclass): | |
def class_names(self): | |
return 'I am class A' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Superclass: | |
super_class_call = 0 | |
def class_call(self): | |
self.super_class_call += 1 | |
print('I am Superclass') | |
class ClassA(Superclass): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Superclass: | |
super_class_call = 0 | |
def class_call(self): | |
print('I am Superclass') | |
self.super_class_call += 1 | |
class ClassA(Superclass): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Rectangle: | |
sides = 4 | |
all_sides_equal = False | |
opposite_sides_equal = True | |
type = 'rectangle' | |
def area(self): | |
length = int(input('Enter length: ')) | |
width = int(input('Enter width: ')) | |
return length * width |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Book: | |
def __init__(self, name, author, publisher): | |
self.name = name | |
self.author = author | |
self.publisher = publisher | |
def book_details(self): | |
return f'{self.name} by {self.author} from {self.publisher}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Book: | |
def __init__(self, name, author, publisher): | |
self.name = name | |
self.author = author | |
self.publisher = publisher | |
def book_details(self): | |
return f'{self.name} by {self.author} from {self.publisher}' |
OlderNewer