Advertisement
Guest User

Untitled

a guest
Sep 8th, 2019
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1.  
  2. def soal(x):
  3. pembilang = x**2-1
  4. penyebut = x -1
  5. try:
  6. hasil = pembilang/penyebut
  7. except ZeroDivisionError:
  8. hasil = float('inf')
  9. return hasil
  10.  
  11. limx = 1
  12. limb = limx + 0.5
  13. limp = 0.05
  14. limx1 = limx - limp
  15. hasilnya = 0
  16. while limx < limb+ 0.5:
  17. #print(limx1)
  18. limx1 =limx1 + 0.01
  19. print(soal(limx1))
  20. limx = limx + 0.1
  21. if soal(limx1) != float('inf'):
  22. #print(soal(limx1))
  23. hasilnya = hasilnya + soal(limx1)
  24.  
  25.  
  26. print("hasil limitnya = ")
  27. print(hasilnya/9)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement