Question:

Python help!!!!!!!!!!

by  |  earlier

0 LIKES UnLike

okay im creating a type based game and it uses varibles like

food heath guns inventory

and it set up like

player = input(">>")

if player == "food":

print"yum"

now it oly uses the if statement once so what would i use if i wanted it to make the if statements come back into play

for example when the script is run and type food it says yum but if i type ammo nothing happends(the if statements went out of play)

 Tags:

   Report

2 ANSWERS


  1. i can help but could u please be more clear ...

    u can email me  


  2. Generally, this sort of thing is done thru an event handler. Since you want to 'handle' the player input whenever they enter it, you would define an event handler to basically 'listen' for a particular event. In this case, you're waiting for keyboard input (and probably specifically for the Enter key to be pressed) at which point you'd execute a function to interpet what was entered and act accordingly.  
You're reading: Python help!!!!!!!!!!

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.
Unanswered Questions