def run_heads_legs(): """Runs heads_legs function.""" print("Enter the amount of heads on the farm: ") heads = integer_input(maximum=1000, positive=True) print("Enter the amount of legs on the farm: ") legs = integer_input(maximum=1000, positive=True) print("Number of chickens and rabbits is: {}".format( heads_legs(heads, legs)))
def run_where_is_vasya(): """Find a number of possible positions Vasya can ocupy.""" print("Number of people in line = ") total = integer_input(positive=True) print("In front of Vasya (no less than) = ") in_front = integer_input(maximum=total - 1, positive=True) print("Behind Vasya (no more than) = ") behind = integer_input(maximum=total - 1, positive=True) print(where_is_vasya(total, in_front, behind))
def run_gap_in_primes(): """Run gap_in_primes function.""" print("Gap size = ") gap = integer_input(minimum=2, positive=True) print("Start position = ") start = integer_input(minimum=3, positive=True) print("End position = ") end = integer_input(minimum=start, positive=True) print(gap_in_primes(gap, start, end))
def run_sequence_sum(): """ run sequence sum """ print("Start of sequence: ") begin_number = integer_input() print("End of sequence: ") end_number = integer_input() print("Step: ") step = integer_input() print("sum of sequence = {}".format( sequence_sum(begin_number, end_number, step)))
def run_duty_free(): """ This function is entry point of program""" print('Price') price = integer_input(positive=True) print('Discount') discount = integer_input(positive=True) print('Holiday cost') holiday_cost = integer_input(positive=True) print('You can buy {} bottles of whiskey:D'.format( duty_free(price, discount, holiday_cost)))
def run_angle(): """ Runs angle function. """ print("Input number of angles") number = integer_input(minimum=3, positive=True) print(angle(number))
def run_new_avg(): """Run new_avg function.""" print("Array = ") arr = integer_list_input() print("Expected average = ") navg = integer_input() print(new_avg(arr, navg))
def run_prime_factors(): """ Runs prime_factors function. """ print("number: ") num = integer_input(minimum=1, positive=True) print('it`s primes: ' + prime_factors(int(num)))
def run_divisible_by(): """Runs divisible_by function""" array = integer_list_input() divisor = integer_input(positive=True) divisible = divisible_by(array, divisor) expression = "Numbers that are divisible by {}: {}".format(divisor, divisible) \ if divisible else "None of given numbers are divisible by {}".format(divisor) print(expression)
def run_find_nb(): """Runs find_nb function""" print("The volume: ") volume = integer_input(positive=True) cubes = find_nb(volume) expression = "The number of cubes is: {}".format(cubes) \ if not cubes == -1 else "Cannot find number of cubes for given volume" print(expression)
def run_triple_shiftian(): """Runs triple_shiftian function.""" print("Enter first three elements of Triple Shiftian: ") first_three_elements = integer_list_input(length=3) print("Enter sequence number: ") num = integer_input(positive=True) result = triple_shiftian(first_three_elements, num) print("The {}th element of Triple Shiftian is: {}".format(num, result))
def run_moving_shift(): """ This function is entry point of program""" plain_text = str(input('Enter your message: ')) print('Shift') shift = integer_input() encrypted_message = moving_shift(plain_text, shift) print('Your encrypted message: {}'.format(encrypted_message)) print('Your decrypted message: {}'.format( demoving_shift(encrypted_message, shift)))
def run_interp(): """ This function is entry point of program""" func = str(input('Enter string or trigonometric function: ')) print('Value l') l_a = float_input(positive=True) print('Value u') u_b = float_input(positive=True) print('Value n') n_c = integer_input() print('Your intermediate results: {}'.format(interp(func, l_a, u_b, n_c)))
def run_sum_of_square(): """ THis function is entry point of program""" binomial_coefficients = integer_input() print('Your sum of the squares: {}'.format( sum_of_square(binomial_coefficients)))
def run_smallest(): """Run smallest function.""" print("Number = ") num = integer_input(positive=True) print(smallest(num))
def run_fib_product(): """Runs fib_product function.""" print("Enter product of 2 numbers: ") prod = integer_input(positive=True) print("Entered number is a product of these two numbers: {}".format( fib_product(prod)))
def run_replicate(): """Run replicate function""" times = integer_input(positive=True) number = integer_input(positive=True) print(replicate(times, number))
def run_zeros(): """Run zeros function""" number = integer_input(positive=True) print(zeros(number))
def run_series_sum(): """Runs series_sum function""" print("Input a term:") term = integer_input(positive=True) series = series_sum(term) print("Sum of the series up to {} term is: {}".format(term, series))
def run_am_i_wilson(): """Run am_i_wilson function.""" print("Number = ") number = integer_input() print(am_i_wilson(number))