Difference between revisions of "Tugas 1"

From ccitonlinewiki
Jump to: navigation, search
(Replaced content with "https://pastebin.com/jPVDr33a Media:https://pastebin.com/jPVDr33a")
Line 1: Line 1:
<nowiki>def soal(x):
+
https://pastebin.com/jPVDr33a
pembilang = x**2-1
+
[[Media:https://pastebin.com/jPVDr33a]]
penyebut = x -1
 
try:
 
hasil = pembilang/penyebut
 
except ZeroDivisionError:
 
hasil = float('inf')
 
return hasil
 
 
 
limx = 1
 
limb = limx + 0.5
 
limp = 0.05
 
limx1 = limx - limp
 
hasilnya = 0
 
while limx < limb+ 0.5:
 
#print(limx1)
 
limx1 =limx1 + 0.01
 
print(soal(limx1))
 
limx = limx + 0.1
 
if soal(limx1) != float('inf'):
 
#print(soal(limx1))
 
hasilnya = hasilnya + soal(limx1)
 
 
 
 
print("hasil limitnya = ")
 
print(hasilnya/9)
 
</nowiki>
 
def soal(x):
 
pembilang = x**2-1
 
penyebut = x -1
 
try:
 
hasil = pembilang/penyebut
 
except ZeroDivisionError:
 
hasil = float('inf')
 
return hasil
 
 
 
limx = 1
 
limb = limx + 0.5
 
limp = 0.05
 
limx1 = limx - limp
 
hasilnya = 0
 
while limx < limb+ 0.5:
 
#print(limx1)
 
limx1 =limx1 + 0.01
 
print(soal(limx1))
 
limx = limx + 0.1
 
if soal(limx1) != float('inf'):
 
#print(soal(limx1))
 
hasilnya = hasilnya + soal(limx1)
 
 
 
 
print("hasil limitnya = ")
 
print(hasilnya/9)
 

Revision as of 12:00, 9 September 2019