0% found this document useful (0 votes)
2 views2 pages

New Sandbox Program

The document outlines a Python program called 'My Vacation Pack Checker' designed to help users remember essential packing items for trips. It includes functionalities to add items to a packing list, check for missing essential items, and display the current packed items. The program features a command-line interface with various commands for user interaction.

Uploaded by

oliverzhang1053
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

New Sandbox Program

The document outlines a Python program called 'My Vacation Pack Checker' designed to help users remember essential packing items for trips. It includes functionalities to add items to a packing list, check for missing essential items, and display the current packed items. The program features a command-line interface with various commands for user interaction.

Uploaded by

oliverzhang1053
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

# AP CSP Performance Task Project

# My Vacation Pack Checker - because I always forget something!

# Very necessary items


ESSENTIAL_ITEMS = [
'toothbrush',
'underwear', # learned this the hard way
'phone charger',
'meds',
'wallet'
]

# Stuff I packed so far


my_bag = []

def show_help():
print("\nCommands:")
print("add [item] - Pack an item")
print("list - Show packed items")
print("check - See what's missing")
print("done - Exit program")
print("help - Show this message")

# Checks to see if you already have the item, adds the item if not.
def add_item(item):
if item.lower() in [x.lower() for x in my_bag]:
print(f"Uh, you already packed {item}...")
else:
my_bag.append(item)
print(f"Added {item} to your bag")

# Shows the current list of items in the bag


def list_items():
if not my_bag:
print("Your bag is empty! You need to pack something.")
else:
print("\nYour bag contains:")
for i, item in enumerate(my_bag, 1):
print(f"{i}. {item}")

# Shows the missing items from the essential items list


def check_missing():
missing = []
for item in ESSENTIAL_ITEMS:
if item.lower() not in [x.lower() for x in my_bag]:
missing.append(item)

if not missing:
print("LOOK AT YOU! You remembered everything for once!")
else:
print("\nALERT! You're missing:")
for item in missing:
print(f"- {item} (seriously don't forget this)")

if 'phone charger' in missing:


print("\nPro tip: You'll be miserable without that charger")

def main():
print("=== My Clunky Packing Helper ===")
print("Type 'help' if you get confused (like I do)\n")

while True:
cmd = input("What now? ").strip().lower()
if cmd == 'done':
print("Good luck on your trip! Hope you packed pants...")
break

elif cmd == 'help':


show_help()

elif cmd == 'list':


list_items()

elif cmd == 'check':


check_missing()

elif cmd.startswith('add '):


item = cmd[4:].strip()
if item:
add_item(item)
else:
print("What?")

else:
print("Huh? Type 'help' if you're confused")

if __name__ == '__main__':
main()

You might also like