indentation error python 1 -


i have no clue why there's indentation area it's realy stresssing me out

print "hello!" print "i\'m charlie , i\'m going test security of password!" print "first i\'d know bit you! name? (no data stored!!)" name = raw_input() print "nice meet you, %s!" % (name) print "what date of birth?" dob = raw_input() print "ok! answers used me forgotten when close window!" print "now %s, ready password tested?" % (name)     if raw_input() = "yes"         print "what password?"     if raw_input() = "no"         print "suit yourself, %s!" % (name) 

first of all, indentation off when write if statements. need bring them 1 tab space.

here example of working code:

print "hello!" print "i\'m charlie , i\'m going test security of password!"  print "first i\'d know bit you! name? (no data stored!!)" name = raw_input() print "nice meet you, %s!" % (name)  print "what date of birth?" dob = raw_input()  print "ok! answers used me forgotten when close window!" print "now %s, ready password tested?" % (name)  # fixed indentation below:  if raw_input() == "yes": #<-- fixed comparison operator here , added colon     print "what password?" if raw_input() == "no": #<-- fixed comparison operator here , added colon     print "suit yourself, %s!" % (name) 

here changed = sign ==. = sign use when declaring variable, name = raw_input(), creates variable name value of raw_input().

the == sign use when comparing 2 things, raw_input() == "yes", checks whether or not raw_input() value equal "yes".


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -