Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/python
- def func8(argument):
- x = float(argument)
- acc = 0.001
- chislitel = x
- znamenatel = 1
- mnozhitel = 1
- curr_iter = 1
- prev_iter = 0
- while 1:
- chislitel = chislitel*x*x
- znamenatel = znamenatel * (mnozhitel + 1) * (mnozhitel + 2)
- slagaemoe = chislitel/znamenatel
- curr_iter = prev_iter + slagaemoe
- if slagaemoe < acc:
- return curr_iter
- mnozhitel = mnozhitel + 2
- prev_iter = curr_iter
- vvod = raw_input("vvedite x: ")
- print "otvet:" + str(func8(vvod))
- vvod = raw_input("press any key")
Advertisement
Add Comment
Please, Sign In to add comment