Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 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.         self.a = a
  9.         while self.a < 0:
  10.             self.a = int(input('podaj dodatnia podstawe'))
  11.  
  12.     def defi(self, x):
  13.         print(self.definicja)
  14.         print(math.log(x, self.a))
  15.  
  16.  
  17. def main():
  18.     a = int(input('Podaj konstruktor(podstawe logarytmu): '))
  19.     newLogExp = LogExp(a)
  20.     x = int(input('Podaj liczbę, którą chcesz zlogarytmować: '))
  21.     newLogExp.defi(x)
  22.  
  23. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement