1

Ok so I changed it to:

if input('a'):
      print ("You: Gimme a gun!")

if input('b'):
       print ("You: Fine")

But now I don't get a choice it forces me to choose a and then after that it forces me to choose b, once I get past this hurdle I have the rest of the game in the bag but I really need help to figure this out P.S. I am noob to python

import time
Gimme=True
Fine=True




print ("James: Ah, it looks like subject 091-266 is awake")
time.sleep(4)
print ("Scarlet: Hello, do you remember anything? The crash or anything?")
time.sleep(4)
print ("You: What.... Where am I?")
time.sleep(3)
print ("Scarlet: Oh, where are my manners, this is the head quarters of the XionRepublic, Xion")                        
time.sleep(5)
print ("James: You were involved in Z-9102, code named Attack-Z")
time.sleep(4)
print ("Scarlet: We were able to pull you and three others out before we  were forced to...")                                             
print ("James: Exterminate Alpha Base 12.")
time.sleep(6)
print ("You: Exterminate?! Couldn't you just quarantine it?")
time.sleep(4)
print ("Scarlet: No, Alpha Base 12 had over 3,000 people in it, it was to risky to quarantine")      
time.sleep(5)
print ("James: Do you recognize these names, Noah, Alex or Robert?")
time.sleep(4)
print ("You: Yes Alex!? Why? Is he ok?!")
time.sleep(3)
print ("James: Yes, Yes he was one of the three.")
time.sleep(4)
print ("*ALARM! SECURITY BREACHED, SECURITY BREACHED*")
time.sleep(4)
print ("James: Scarlet lock the door!")
time.sleep(3)
print ("You: Whats going on?!")
time.sleep(3)
print ("James: Z's there here.")
time.sleep(3)
print ("*Screaming*")
time.sleep(2)
print ("You: I can fight!")
time.sleep(3)
print ("Scarlet: Trust me you are not in any condition to fight due to some of the drugs in you")   
print ("CHOICE")
print ("A.Gimme the gun!")
print ("B.Fine")

if raw_input() == Gimme:
    print ("You: Gimme a gun!")
if raw_input() == Fine:
    print ("You: Fine")
4
  • 1
    If your python version is 3.x then use input(). python.org/dev/peps/pep-3111 Commented Apr 14, 2013 at 20:01
  • possible duplicate of How do I use raw_input in Python 3.1 Commented Apr 14, 2013 at 20:07
  • Its not a duplicate, that does not even show up under related... Commented Apr 14, 2013 at 20:20
  • @user2278741: did you read the linked question? It explains exactly what the problem is, and gives the same answer as the people who answered here to your original question. Commented Apr 14, 2013 at 20:24

4 Answers 4

5

If you are using the new versions of python -- 3.x.x -- then raw_input no longer exists. Use input(prompt) instead. It works pretty much the same. basic Syntax:

foo = input("some prompt"). 

What input does is it reads a line from the standard input file, or <stdin>. It prints the prompt within the () and then waits for user input. Example: (>>> is the command line prompt, <<< is output

Command Line, interactive mode (or IDLE): 
>>> foo = input("GIMME SOME INPUT: ")  #tell it to take some input
<<<GIMME SOME INPUT: foo          # it prints out, "GIMME SOME INPUT:" user types in foo
>>> print(foo)
<<< foo

Response to your edit:

Use this:

print ("CHOICE")
print ("A.Gimme the gun!")
print ("B.Fine")
choice = input("What do you choose?")
if choice == 'A' or choice == 'a':
    #Some Action 
if choice == 'B' or choice == 'b': 
    #Some Other Action  
Sign up to request clarification or add additional context in comments.

Comments

1

You appear to be using Python 3. In Python 3, raw_input() has been renamed to input().

Comments

1

Re your new question:

But now I don't get a choice it forces me to choose a and then after that it forces me to choose b

That's because you're calling input() twice, and each time you call it, you're prompted to type something. You want to call it once, store the value you get in a variable, and compare that variable to the possible choices.

2 Comments

what are you reading to learn Python? it should hopefully have explained variables by now...
When you call input function you are telling python that you want the user to make an input. If you call input twice, python will think you want two inputs.
0

If you are using python 3 or later, then the raw_input function is replaced by normal input()

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.