While creating a program how do you create a condition within a condition, I mean can you actually do that.

for example

def example():
answer=raw_input("where do you want to go?")
if answer=="left":
print "you have turned left, now go straight"
#now if you wanted to make another condition that do you want to go straight or not under the same 'if' condition what to do???
if answer== "right":
print "you have gone right"


you can simple nest if conditions:

if condition:
    if condition:


But what to do if you want it to take input again???


that is a different question alltogether? idealy, use a while loop


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.