On 08/25/2010 06:00 AM, Roelof Wobben wrote:
> 
> Hello, 
> 
>  
> 
> I have this programm :
> 
>  
> 
> def remove_letter(letter, strng):
>     """
>       >>> remove_letter('a', 'apple')
>       'pple'
>       >>> remove_letter('a', 'banana')
>       'bnn'
>       >>> remove_letter('z', 'banana')
>       'banana'
>       >>> remove_letter('i', 'Mississippi')
>       'Msssspp'
>     """
>     antwoord=""
>     for letter in strng:
>         print letter, strng
>         if letter in strng:
>             print "false"
>         else:
>             print "true"
>     return antwoord
> 
>  
> 
> x=remove_letter('a', 'apple')
> print x 
> 
>  
> 
> But now everything is false even a in apple.
> 
>  
> 
> What is here wrong ?
> 
I'm assuming what you really want is :

if letter in strng:
    print "true"
else:
    print "false"


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

Reply via email to