i have two questions-
1.>>> removeLetter("hello", "l")
   >>>'heo'

To tackle this problem i am using set so that i can remove duplicates.
def removeLetter(word,letter)
????set(word).remove(letter)
????return ''.join(set(word))

I am not getting right answer.I think i am not using sets correctly.please
help!!!

Approach:-
>>> a='hello'
>>> set(a)
set(['h', 'e', 'l', 'o']), so i am thinking somehow if i remove 'l' and i
join the string, i will get the desired output.

2.
>>> a='microsoft'
>>> set(a)
set(['c', 'f', 'i', 'm', 'o', 's', 'r', 't'])
>>> print ''.join(set(a))
cfimosrt

When i print "Hello", i get the output as "helo"(in same sequence) but when
i write "microsoft" i get this-"cfimosrt". So, it means i can't predict the
outcome of set(a)??
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to