P. Schmidt-Volkmar wrote: > Hi there, > > I have a string in which I want to calculate how often the character ';' > occurs. If the character does not occur 42 times, the ";" should be added so > the 42 are reached. > > My solution is slow and wrong: > > How can this be achieved easily?
Is this homework? str.count() and string multiplication are your friends here. See http://docs.python.org/lib/string-methods.html http://docs.python.org/lib/typesseq.html Kent -- http://mail.python.org/mailman/listinfo/python-list