# loop:
#   ask for name max length 10 (retry until suitable)
#   ask for amount (hourly) (between 99p and £5.99) (retry until suitable)
# after user confirms they are done entering data,
# print out the data in tabular format with suitable column headings
# use main() function and functions with docstrings

def get_name():
    collect = True
    while collect:
        name = input("Enter the activity: ")
        if len(name) > 10:
            print("Name too long. Please try again.")
            continue
        else:
            collect = False
    return name

def get_amount():
    collect = True
    while collect:
        amount = float(input("Enter activity hourly rate in pence: "))
        # if less than 99 pence or greater than 599
        if amount < 99 or amount > 599:
            print("Amount out of range. Please try again.")
            continue
        else:
            collect = False
    return amount

def print_data(data):
    print("\nActivity - Amount")
    print("-" * 15)
    for activity in data:
        print(f"{activity[0]} - {f"£{activity[1]/100}"}")

def main():
    run = True
    
    data = []
    
    while run:
        activity = get_name()
        amount = get_amount()
        print(f"{activity} - {f"£{amount/100}"}")
        user_choice = input("Would you like to add another activity? (y/n): ")
        if user_choice.strip().lower() == "n":
            run = False
            
        data.append([activity, amount])
    
    print_data(data)

if __name__ == "__main__":
    main()
    