SHOW:
|
|
- or go back to the newest paste.
| 1 | - | import random |
| 1 | + | #! /usr/bin/python |
| 2 | ||
| 3 | - | n = int(raw_input('N = '))
|
| 3 | + | def func8(argument): |
| 4 | - | x = [random.randint(0, 100) for i in xrange(n)] |
| 4 | + | x = float(argument) |
| 5 | acc = 0.001 | |
| 6 | - | print x |
| 6 | + | chislitel = x |
| 7 | - | print max(x) |
| 7 | + | znamenatel = 1 |
| 8 | - | print sum(x) |
| 8 | + | mnozhitel = 1 |
| 9 | - | print [i for i in x if i != 0][::-1] |
| 9 | + | curr_iter = 1 |
| 10 | prev_iter = 0 | |
| 11 | ||
| 12 | while 1: | |
| 13 | chislitel = chislitel*x*x | |
| 14 | znamenatel = znamenatel * (mnozhitel + 1) * (mnozhitel + 2) | |
| 15 | ||
| 16 | slagaemoe = chislitel/znamenatel | |
| 17 | curr_iter = prev_iter + slagaemoe | |
| 18 | ||
| 19 | if slagaemoe < acc: | |
| 20 | return curr_iter | |
| 21 | mnozhitel = mnozhitel + 2 | |
| 22 | prev_iter = curr_iter | |
| 23 | ||
| 24 | vvod = raw_input("vvedite x: ")
| |
| 25 | print "otvet:" + str(func8(vvod)) | |
| 26 | vvod = raw_input("press any key") |