def main():
            print (" PC : Hi there.whats your name?")
            userit = raw_input (" user :")
            print (" Pc : Nice to meet you " ) , userit ,
            userit = raw_input(" Do you like python? (A=its Great, B=its Ok, C=its Rotten)")
        if userit == A:
            userit = userit.upper()
            print ("\n  Thats good. I like it too ") ,userit ,
        
        elif userit = B:
            userit = userit.upper()
            print ("\n  really what ever you say ") ,userit ,
        elif userit = C:
            userit = userit.upper()
            print ("\n  Thats bad ") ,userit ,
        else:
            print ("\n  Please enter from the Above options ") ,userit

            usergame = raw_input(" whats your rating in tennis? (A=best, B=better, C=better)")
        if usergame == A:
            usergame = userpl.upper()
            print ("\n  wonderful i think you must compete federer ") ,userit ,
        elif usergame = B:
            usergame = userpl.upper()
            print ("\n  good to play with me ") ,userit ,
        elif usergame = C:
            usergame = userpl.upper()
            print ("\n  need more learn the game ") ,userit ,
        else:
            print ("\n  Please enter from the Above options ") ,userit

            userpl = raw_input(" which country do you like the most? (A=united states, B=Dubai, C=england)")
        if userpl == A:
            userpl = userpl.upper()
            print ("\n  nice place to live ") ,userit ,
        elif userpl = B:
            userpl = userpl.upper()
            print ("\n  Too expensive  ") ,userit ,
        elif userpl = C:
            userpl = userpl.upper()
            print ("\n  good choice ") ,userit ,
        else:
            print ("\n  Please enter from the Above options ") ,userit

            userfood = raw_input(" what is your favorite food? (A=chinese, B=mexican, C=indian)")
        if userfood == A:
            userfood = userfood.upper()
            print ("\n  hmmm thats mouth watering") ,userit ,
        elif userfood = B:
            userfood = userifood.upper()
            print ("\n  you are into the right place  ") ,userit ,
        elif userfood = C:
            userfood = userfood.upper()
            print ("\n  i think you are going to taste spicy curry  ") ,userit ,
        else:
            print ("\n  Please enter from the Above options ") ,userit

main(the error is unindent doesnot match any indentation level can some one help

Editor's note: please use code tags. something like this ...
[code=python]
your Python code here

[/code]
Make your indentations uniformly 4 spaces, you are mixing 8 spaces and 4 spaces, probably due to your text editors tab settings. Avoid using tabs!!!!

Recommended Answers

All 3 Replies

Well, I would love to help you, but your post contains no indentation at all. PLEASE post your code in CODE tags! I can't help you if any code you post doesn't contain your indentation. So, re-post your code (or edit the above, preferably) and wrap it in [CODE] tags! Thank you.

You've got numerous indentation errors in your code as vegas seat mentioned... first off, fix your lines 2-5 above, as they need to be at the same indentation level as your first if statement... Then work from there, as you've got a LOT of work to do to get this program to pass a simple syntax check, not to mention to get it running.

Some things you need to learn and apply to this script:
- The difference between the comparative (==) and the assigning (=) usage of the equal sign
- How to compare a variable to a string
- How to use the print function
- How to call a function
- How to indent

Also note that in the following code you convert to upper case after testing for an upper case letter. You want to convert to upper() once only directly after the input.

if userit == A:
            userit = userit.upper()
            print ("\n  Thats good. I like it too ") ,userit ,

This can be replaced with a dictionary if you want. This is especially good when you have a lot of options.

if userit == A:
            userit = userit.upper()
            print ("\n  Thats good. I like it too ") ,userit ,
 
        elif userit = B:
            userit = userit.upper()
            print ("\n  really what ever you say ") ,userit ,
        elif userit = C:
            userit = userit.upper()
            print ("\n  Thats bad ") ,userit ,
        else:
            print ("\n  Please enter from the Above options ") ,userit
# 
#---  Replace with (code not tested)
python_dic = {"A":" Thats good. I like it too ",
                       "B":" really what ever you say ",
                       "C":" Thats bad "}
userit = "X"   ##  gets us into the while loop
while userit not in python_dic:
     userit = raw_input(" Do you like python? (A=its Great, B=its Ok, C=its Rotten)")
     userit = userit.upper()
     print 
     if userit in python_dic:
          print python_dic[userit], userit,
     else:
          print ("\n  Please enter from the Above options ") ,userit
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.