I have this informational “game” (in a way) where you get info when you select an option, yet every time you do it crashes, what do I need to do?
code: https://gist.github.com/sand-undertale/6a8d82c088e1bef706833667fcac578f
I tried to input an option, and I expected the info to appear.
6
Your problem is not that the compilation is not working but rather that when running the exe (by clicking on it) a window is spawned that is bound to the process. Once you enter an option your code does it’s magic and then exits, leading to the closure of the window.
To solve that is enough to put an input at the end of the code to keep the window open untill you press enter:
print("[My Name] SAE Project v.1.0.0.")
print("1. FFA History.")
print("2. AG History.")
print("3. FFA Meaning.")
print("4. AG Meaning.")
print("5. Why Is FFA important?")
print("6. Why is AG Important?")
choice = int(input("Enter your choice: "))
if choice == 1:
print(
"The National FFA Organization was founded in 1928. It began as an organization for boys interested in farming but has since evolved into an inclusive student organization promoting agricultural education. The FFA aims to develop students' leadership, personal growth, and career success through agricultural education."
)
if choice == 2:
print(
"From 1700 to 2024, U.S. farming went from small farms growing crops like tobacco and cotton to larger, more efficient operations. New tools and machines, like the cotton gin and tractors, helped farmers increase production. Today, farming uses high-tech equipment and focuses on sustainability while feeding the world."
)
if choice == 3:
print("Future Farmers of America.")
if choice == 4:
print("Agriculture, eg. farming, fishing, etc.")
if choice == 5:
print(
"FFA is important so young, inspiring farmers can be educated on what they want to me when they grow up."
)
if choice == 6:
print(
"Agriculture is important becuase it is one if the main sources of food in our modren world, it's how all of our crops, meat, and materials are farmed/created."
)
input()
Otherwhise you could just open a terminal and run the exe from there, this would also solve the issue since your exe will return to the terminal session rather than closing the window.
2