Hello all, well, I am new to these forums, and fairly new to Python. I know some python though, so I am not a complete "newb" so to speak. But I was wondering how to have python while loops work for two variables or strings or w.e. here's a piece of some simple code right now that I am working on.

import sys
a = "/help"
b = "awesome1"
print ("This is a test script for multiple while loops")
an = raw_input("type /help to continue:\n ")

if an == a:
    import hfile
elif an == b:
    import helloworld
while an != a:
    print("That is invalid!\n")
    an = raw_input("type /help to continue or the password:\n ")

so, basically what I want it to do is have the while have two conditions. in this case Condition a and b. Thanks in advance,

You can use

while an not in (a, b):

I think you just want a simple menu program

def func_a():
   print "     hello world import"
def func_b():
   print "     hfile import"

menu_d = { "awesome1":'func_a()', 
choice = ""
while choice not in menu_d:
   choice = raw_input("type /help to continue or the password:\n ")
   if choice in menu_d:
print "\nend of program"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.