Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class zlaPodstawa(Exception):
- def __str__(self):
- return "Zła wartosc podstawy"
- class zlyArgument(Exception):
- def __str__(self):
- return "Zła wartosc argumentu"
- class roznePodstawy(Exception):
- def __str__(self):
- return "Rozne wartosci podstaw"
- class Logarytm:
- def __init__(self, podstawa, argument, ):
- if podstawa <= 0 or podstawa == 1:
- raise zlaPodstawa()
- self.podstawa = podstawa
- if argument <= 0:
- raise zlyArgument()
- self.argument = argument
- def __add__(self, other):
- if self.podstawa == other.podstawa:
- return (self.podstawa, self.podstawa * other.podstawa)
- else:
- raise roznePodstawy()
- def __str__(self):
- return "log" + self.podstawa + "(" + self.argument + ")"
- def redukuj(self):
- l = Logarytm(5, 2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement