def main(): import ux def main_loop(): choice = ux.get_user_choice(options) print("\n") if choice == 1: values = randomTest() elif choice == 2: values = userInputTest() print("\n\tValues:", values, "\n") _high = max(values) _low = min(values) _mean = mean(values) _median = median(values) _mode = mode(values) _variance = variance(values, average=_mean) _std_dev = std_dev(values, average=_mean, var=_variance) print("\tHigh", _high) print("\tLow", _low) print("\tMean:", _mean) print("\tMedian:", _median) print("\tMode:", _mode) print("\tVariance:", _variance) print("\tStandard Deviation:", _std_dev) print("\n\n") ux.to_continue(main_loop)
def main(): def main_loop(): choice = ux.get_user_choice(OPTIONS) switch(choice) ux.to_continue(main_loop)
def main(): def main_loop(): try: print("\n\n") a = int(input(" Enter the first number: ")) b = int(input(" Enter the second number: ")) x = gcd(a, b) # Output print("\nThe GCD of,", a, "&", b, "is:", x, "\n") except ValueError as e: print("\n\n Please enter a valid choice.\n") ux.to_continue(main_loop)
def main(): def main_loop(): try: print("\n\n") a = int(input(" Enter an integer to check if it is prime: ")) if is_prime(a): print("\n ",a,"is a prime number.\n") else: print("\n ",a,"is not a prime number.\n") except ValueError as e: print("\n\n Please enter a valid choice.\n") ux.to_continue(main_loop)
def main(): def main_loop(): try: print("\n\n") a = int(input(" Enter an integer to reverse: ")) _a = reverse_num(a) # Output print("\n\tOriginal", a) print("\tReversed", _a) print("\n") except ValueError as e: print("\n\n Please enter a valid choice.\n") ux.to_continue(main_loop)
def main(): def main_loop(): try: print("\n\n") print("\n Format: \n") print(" b^e mod m \n") b = int(input(" Enter b: ")) e = int(input(" Enter e: ")) m = int(input(" Enter m: ")) result = pmod(b, e, m) print("\n Result:",result,"\n") except ValueError as e: print("\n\n Please enter a valid choice.\n") ux.to_continue(main_loop)
def main(): def main_loop(): choice = ux.get_user_choice(OPTIONS) print("\n\n") if choice == 1: a = int(input(" Enter an integer in decimal: ")) result = dec_to_bin(a) # Output print("\n Decimal:", a, "\n") print("\n Binary: ", end="") print_bin(result) elif choice == 2: a = input(" Enter a binary string: ") a_bin = parse_bin(a) result = bin_to_dec(a_bin) # Output print("\n Binary: ", end="") print_bin(a_bin) print("\n Decimal:", result, "\n") ux.to_continue(main_loop)