Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. import math
  2.  
  3.  
  4. class LogExp:
  5. definicja = 'log(x, y) - Zwraca logarytm z X o podstawie "y" ale jeżeli nie ma podstawy to bedzie logarytm o podstawie (y) 10.'
  6.  
  7. def __init__(self, a):
  8. if a == 0 or a == '0':
  9. self.a = 10
  10. else:
  11. self.a = a
  12.  
  13. #uwagaaaa to defii ja dodalem od siebie.. i powoduje ze nie dziala ta funkcja
  14. def defii(self, a):
  15. while a < 0:
  16. self.a = int(input('podaj dodatnia podstawe'))
  17.  
  18. def defi(self, x):
  19. print(self.definicja)
  20. print(math.log(x, self.a))
  21.  
  22.  
  23. def main():
  24. a = int(input('Podaj konstruktor(podstawe logarytmu): '))
  25. newLogExp = LogExp(a)
  26. x = int(input('Podaj liczbę, którą chcesz zlogarytmować: '))
  27. newLogExp.defi(x)
  28.  
  29.  
  30. if __name__ == '__main__':
  31. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement