"Roelof Wobben" <rwob...@hotmail.com> wrote

######################
def remove_letter(letter, strng):
   antwoord=""
   for letter in strng:
       print letter, strng
       if letter in strng:
           print "false"
       else:
           print "true"
   return antwoord
######################

Several issues:

1) You never use antwoord so it alweays returns ""
2) you print false when the letter IS in the string
3) You use letter as an input parameter but then overwrite it in the for loop.
4) your if test would be better written as

print (letter in string)

(The parens aren't necessary but I think make it clearer that
we are printing the evaluation of an expression not just a string with
missing quotes...)

HTH,


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to