예제 #1
0
def req(num: int):
    i = int(num)
    return str(fib(i))
예제 #2
0
import requests
from func import fib
from utils import timeit

n = 20
req = 'http://localhost:9999/req/' + str(n)
repeats = 10

expect = fib(n)

reqs = [req] * repeats

timed_req_get = timeit(requests.get)
resps = map(timed_req_get, reqs)

resps_200 = [r for r in resps if r.status_code == 200]

resps_correct = [r for r in resps_200 if int(r.text) == expect]

print(repeats, len(resps_correct))
예제 #3
0
 x = input()
 if x == 'encrypter -r':
     func.encrypter()
     exit(0)
 if x == 'powme -r':
     y = int(input('choose a number to power by himself:  '))
     func.powme(y)
     exit(0)
 if x == 'multicalc -r':
     func.multicalc()
     exit(0)
 if x == 'crusher -r':
     c.crusher()
     exit(0)
 if x == 'fib -r':
     func.fib()
     exit(0)
 if x == 'palindrome -r':
     y = int(input('enter a board:  '))
     func.palindrome(y)
     exit(0)
 if x == 'power -r':
     func.power()
     exit(0)
 if x == 'squereme -r':
     func.squereme()
     exit(0)
 if x == 'trinum -r':
     y = int(input('how many triangular number you want:'))
     print(func.trinum(y))
     exit(0)
예제 #4
0
    print('\n' '-------------------------')


if __name__ == "__main__":
    x = -1

    while x != 0:
        header()

        try:
            x = int(input('::\t'))

            if x > 0:
                try:
                    y = int(input(':|\t'))
                    if x == 1: print(':-\t', f.factorial(y))
                    if x == 2: print(':-\t', f.seq_sum(y))
                    if x == 3: print(':-\t', f.fib(y))
                    if x == 4:
                        [
                            print(f'{i}-\t', j, end='\n')
                            for i, j in enumerate(f.pascals_triangle(y))
                        ]

                except ValueError:
                    print("Input should be an integer greater than ZERO. ")

        except ValueError:
            print("Input should be an integer greater than ZERO. ")

        footer()