Learn Computer Programming Free from our source codes in my website.
Sponsored Link Please Support
https://www.techseries.dev/a/27966/qWm8FwLb
https://www.techseries.dev/a/19181/qWm8FwLb
My Personal Website is http://www.jakerpomperada.com
Email me at jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Friday, May 17, 2024
Thursday, May 16, 2024
Wednesday, May 15, 2024
Tuesday, May 14, 2024
Monday, May 13, 2024
What is Robotics?
What is Robotics?
In simple terms, robotics combines science, engineering, and technology to design, construct, operate, and use machines programmed to replicate, substitute, or assist humans in completing tasks of varying complexity. These machines are known as robots.
Sunday, May 12, 2024
Addition and Subtraction Using Polymorphism in Python
class MathOperation:
def perform_operation(self, a, b):
return 0 # Base class default implementation
class Addition(MathOperation):
def perform_operation(self, a, b):
return a + b
class Subtraction(MathOperation):
def perform_operation(self, a, b):
return a - b
if __name__ == "__main__":
operation = None
num1, num2 = 0, 0
print("\n\n\tAddition and Subtraction Using Polymorphism in Python\n")
num1 = int(input("\tEnter the first number: "))
num2 = int(input("\tEnter the second number: "))
op = input("\tEnter the operation (+ for addition, - for subtraction): ")
if op == '+':
operation = Addition()
elif op == '-':
operation = Subtraction()
else:
print("\tInvalid operation.")
exit()
result = operation.perform_operation(num1, num2)
print("\n\tThe Result:", result)
print("\n\tEnd of Program. Thank you for using this program.")