I took a short break from coding because I went on vacation. Today I came back and made a small detective game in Python. The goal is to investigate the crime, find evidence, talk to suspects, and find the culprit ıf I made any mistakes or there is anything I could improve, I would really appreciate your feedback and help!
def start_game():
print("=== The Mystery ===")
print("A crime happened last night.")
name = input("Detective, what is your name?: ")
print("Welcome", name)
print("Your mission is to find the truth.")
print("\nThere are three suspects:")
print("1. Kai")
print("2. San")
print("3. Hae-in")
choice = input("Who do you want to investigate?: ")
if choice == "1":
print("You chose Kai.")
elif choice == "2":
print("You chose San.")
elif choice == "3":
print("You chose Hae-in.")
else:
print("Invalid choice.")
while True:
print("\nWhat do you want to do?")
print("1. Investigate the crime scene")
print("2. Talk to suspects")
print("3. Check evidence")
print("4. Make an accusation")
print("5. Exit")
choice = input("Choose: ")
if choice == "1":
print("\nYou investigate the crime scene.")
print("You found a strange key.")
elif choice == "2":
print("\n=== SUSPECTS ===")
print("1. Kai")
print("2. San")
print("3. Hae-in")
print("4. Back")
suspect = input("Who do you want to talk to? ")
if suspect == "1":
print("\nKai: I was at the cafe last night.")
print("Kai looks nervous.")
elif suspect == "2":
print("\nSan: I was at home all night.")
print("San seems calm.")
elif suspect == "3":
print("\nHae-in: I left the building at midnight.")
print("Hae-in avoids your questions.")
elif suspect == "4":
print("\nGoing back to the main menu.")
else:
print("\nInvalid choice.")
elif choice == "3":
print("\nYou check the evidence.")
print("You found a note with a mysterious symbol.")
elif choice == "4":
print("\n=== MAKE AN ACCUSATION ===")
print("1. Kai")
print("2. San")
print("3. Hae-in")
print("4. Back")
accusation = input("Who is the culprit? ")
if accusation == "1":
print("\nYou solved the mystery!")
print("Kai was the culprit!")
break
elif accusation == "2":
print("\nWrong accusation!")
print("San was innocent.")
elif accusation == "3":
print("\nWrong accusation!")
print("Hae-in was innocent.")
elif accusation == "4":
print("\nGoing back to the main menu.")
else:
print("\nInvalid choice.")
elif choice == "5":
print("\nGoodbye, detective!")
break
else:
print("\nInvalid choice.")
start_game()
Top comments (0)