import math import pandas as pd def int_check(question, low, high): error = f"Oops - please enter an number that is higher or equal to {low} and lower or equal to {high} ." while True: try: response = float(input(question)) if low <= response <= high: return response else: print(error) except ValueError: print(error) def string_check(question, valid_ans_list, num_letters): """Checks that users enter the full word or the 'n' letter/s of a word from a list of valid responses""" while True: response = input(question).lower() for item in valid_ans_list: if response == item: return item elif response == item[:num_letters]: return item print(f"Please choose an option from the list {valid_ans_list}") data_list = [] radius = int_check("Enter radius: ", 0.1, 100) circumference = 2 * math.pi * radius area = math.pi * radius * radius circumference_round = round(circumference, 2) area_round = round(area, 2) data_list.append({"Circumference": circumference_round, "Area": area_round}) df = pd.DataFrame(data_list) print(df)