Program Error Help - Python 3.1

2019.cavanaughc at fpsedu.org 2019.cavanaughc at fpsedu.org
Fri Mar 31 19:12:48 EDT 2017


Hello I've been coding for about 1 or 2 months and i have encountered a problem with a 'while' statement. It keeps looping even when the statement is false, here is the code. The code is for a game that I'm making that resembles the Oregon Trial.

-Thanks for your help!




import random
deep = random.randint(1, 30)
width = random.randint(15, 50)
print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nYou have approched a river.")
answer8 = ""
while answer8 != ("1") or answer8 != ("2"):
    print("\nWhat would you like to do?")
    print("\t\t 1) Attempt to wade across the river")
    print("\t\t 2) Attempt to float across the river")
    print("\t\t 3) Find out more about the river.")
    answer8 = input("\nWhat is your choice? ")
    if answer8 == 3:
        print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nThe river is", deep, "feet deep and", width, "feet long.")
        input("\n\nPress ENTER to continue. ")
if answer8 == 1:
    if deep <= 5 and deep >=0:
        print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nYou made it across.")
        input("\n\nPress ENTER to continue. ")
    else:
        print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nThere has been an accendint.")
        input("\n\nPress ENTER to continue. ")
if answer8 == 2:
    if deep >=6:
        print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nYou made it across.")
        input("\n\nPress ENTER to continue. ")
    else:
        print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nThere has been an accendint.")
        input("\n\nPress ENTER to continue. ")
input("\n\nPress ENTER to exit. ")


More information about the Python-list mailing list