# hardware items
def display_list(choice, some_list):
print_list = sorted(some_list) if choice == "a" else list(reversed(sorted(some_list)))
print("List from " + ("A" if choice == "a" else "Z") + " to " + ("Z" if choice == "a" else "A"), end = ": ")
count = 0
for item in print_list:
count+=1
print(item, end = " -> " if count < len(print_list) else "")
hardware_items = []
while True:
ask_message = "Enter a hardware item, or 'q' to exit:"
print(ask_message, end = " ")
user_input = input(ask_message)
print(user_input)
if user_input.lower() == "q":
break
hardware_items.append(user_input)
print()
print(f"Entered items: {hardware_items}")
full_list = ["paint", "sandpaper", "glue", "locks"]
full_list.extend(hardware_items)
print()
print(f"Updated list: {full_list}")
print()
ask_message = "Enter 'a' if you want to see list from A to Z, or " + "'z' if you want to see the list from Z to A:"
print(ask_message, end = " ")
user_choice = input(ask_message).lower()
print(user_choice)
if user_choice != "a" and user_choice != "z":
print("Invalid input!")
else:
display_list(user_choice, full_list)