Jun-22-2017, 09:11 PM
So I recently acquired this book "Adventures in Python" by Craig Richardson and I instantly dived into the book as an introduction in the python coding language. It all was a walk in the park until I reached this part. I type all the code down but I keep being stuck in here.
choice = ""
while choice != "/exit":
print "What would you like to do, " + captain + "?"
print ""
print "a. Explore another planet?"
print "b. Fire your Cannons?"
print "c. Open the airlock?"
print "d. Self destruct (ANY RISK IS NOT THE RESPONSIBILITY OF AIRSPACE INDUSTRIES!"
print ""
choice = raw_input ("Enter your choice: ")
The elif's are there thus the program has to obey but yet it doesn't, the output doesn't work. Here is an example of the elif outputs.
if choice == "a":
destination = raw_input("Where would you like to go? ")
print "leaving " + location
print "Travelling to " + destination
time.sleep(5)
print "Arrived at " + destination
location = destination
I will always be stuck on the letter option part even if I type a letter. Hopefully I can have this fixed as quick as possible.
choice = ""
while choice != "/exit":
print "What would you like to do, " + captain + "?"
print ""
print "a. Explore another planet?"
print "b. Fire your Cannons?"
print "c. Open the airlock?"
print "d. Self destruct (ANY RISK IS NOT THE RESPONSIBILITY OF AIRSPACE INDUSTRIES!"
print ""
choice = raw_input ("Enter your choice: ")
The elif's are there thus the program has to obey but yet it doesn't, the output doesn't work. Here is an example of the elif outputs.
if choice == "a":
destination = raw_input("Where would you like to go? ")
print "leaving " + location
print "Travelling to " + destination
time.sleep(5)
print "Arrived at " + destination
location = destination
I will always be stuck on the letter option part even if I type a letter. Hopefully I can have this fixed as quick as possible.