using "else: interactive programme

nigel cm012b5105 at blueyonder.co.uk
Sun Mar 26 10:40:03 EST 2006


Hello i will show you a short  example of my programme.
s = raw_input ("ok lets see about doing some mathematics would you like to try 
some?")
if s=='no':
    print "Well you aint no fun sling your hook"
    print "END OF PROGRAMME"
    print "Go on sling your hook"
    print "Now let some one else have a go"
if s=='yes':
    print "brilliant lets get cracking"
    print "We will start with some easy sums progressing to professor 
standard"
s = raw_input()
s = raw_input ("5 + 5 =")
if s=='10':
    print "Correct"
     else:
        print "you are not very smart it would seem "
        print "Or maybe you are just taking the piss if so behave"
        print "Are you ready to continue"
if s=='no':
    print "Then go away"
if s=='yes':
    s = raw_input ("5 + 5 =")
if s=='10':
    print "Well done"
    else:
        print "tut tut lets try some thing else"

The problem being my programme will not run,I believe it is because i have 
missused "else:" can some one please give me an example of how to correct 
this.Just to recap the programme runs fine until i get to.
"  print "well done" I was under the impression that by using "else:" if the 
wrong answer was typed it would print "tut tut lets try some thing else"
Any thought on this please.
Thanks nige.



More information about the Python-list mailing list