def purchase_flag(balance):
while True:
print("Welcome to the CTF Store Challenge!")
print("Your balance: $" + str(balance))
print("Options:")
print("1. Curtains of Houses - $4")
print("2. Dining Table - $30")
print("3. Flag of the Office - $49")
print("4. Another item (Search for items)")
print("5. Exit")
choice = input("Enter your choice: ")
if choice == "1":
if balance >= 4:
balance -= 4
print("You purchased the Curtains of Houses. Your balance is now $" + str(balance))
else:
print("You don't have enough money to buy the Curtains of Houses.")
elif choice == "2":
if balance >= 30:
balance -= 30
print("You purchased the Dining Table. Your balance is now $" + str(balance))
else:
print("You don't have enough money to buy the Dining Table.")
elif choice == "3":
if balance >= 49:
balance -= 49
print("Congratulations! You purchased the Flag of the Office, which is the challenge flag.")
print("Your balance is now $" + str(balance))
return True
else:
print("You don't have enough money to buy the Flag of the Office.")
elif choice == "4":
while True:
print("Searching for item...")
item = input("Enter the item you want to search for: ")
try:
result = eval(item)
balance = result
print("Sorry, the item you are looking for is not available.")
except Exception:
print("Invalid input. Please enter a valid expression.")
print("Options:")
print("1. Search again")
print("2. Back to list")
search_choice = input("Enter your choice: ")
if search_choice == "1":
continue
elif search_choice == "2":
break
else:
print("Invalid choice. Returning to the list of options.")
elif choice == "5":
print("Exiting the CTF Store Challenge. Goodbye!")
return False
else:
print("Invalid choice. Please enter a number between 1 and 5.")
balance = 10
purchase_flag(balance)
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}