Need help on coding homework


So there should be a minimum of 3 questions, but 2 possible answers for each question. The questions are about whatever you want it to be. It's your own create your own adventure game. For example, ask the user to pick the right path or the left path. When they do, it will trigger a new question based on the answer that the user gave. I need to be able to save the spot the user was at and then allow them to come back later. Each question needs to be saved as it's own function, so you can call it back.

I do not understand how to save my code as a file that the computer can call back and I really need help

I expect that the file will be saved for each of the questions and able to be called back for my teacher to give me a good grade!

print("do you like cookies?")
inp = str(input('please enter yes or no'))

approve = 'do you like cats'
notapprove = 'do you like dogs'
if inp == 'yes':

elif inp == 'no':

inp = str(input('please enter yes or no'))
cats = 'do you like coke or pepsi'
dogs = 'do you like the ocean or lake'
if inp == 'yes':
elif inp == 'no':

inp = str(input('please enter yes or no'))


Python code is stored as regular text files, you can for example use notepad (assuming windows) to create the file for you (although notepad isn't a very good code editor)

It doesn't matter here you put the file as long as Python has read permission for it. For example, you could create a directory named Code in your home directory or documents or whatever you prefer.

How you run the file has a whole lot to do with how you installed it, windows doesn't really teach its users how to carry out some of the most basic operations that you'd do with a computer.. You've likely got IDLE installed, that would take care of both creating files and running them.

On most other operating systems you would open up a terminal in the directory of your code and type:


If your python installer has added python to your path variable, or if you have done so manually, then you can run it the same way on windows.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.