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
from abc import ABC, abstractmethod | |
class Shape(ABC): | |
@abstractmethod | |
def area(self): | |
pass | |
@abstractmethod |
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
from abc import ABC, abstractmethod | |
class Shape(ABC): | |
@abstractmethod | |
def area(self): | |
pass | |
@abstractmethod |
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 Shape: | |
def area(self): | |
pass | |
def perimeter(self): | |
pass | |
class Square(Shape): |
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 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}' |
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 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 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: | |
def class_names(self): | |
return 'I am super class' | |
class ClassA(Superclass): | |
def class_names(self): | |
return 'I am class A' |
NewerOlder