On 14/11/05, john boy <[EMAIL PROTECTED]> wrote: > using the following program: > > prefixes = "JKLMNOPQ" > suffix = "ack" > for letter in prefixes: > print letter + suffix > if prefixes == "O" or "Q"
Here you need: if prefixes == "O" or prefixes == "Q" > print letter + "u" + suffix > > For this program I am trying to combine the individual letters with the > suffix to form names...but for O and Q I need to add in a "u" so the > spelling is correct...I am having a hard time pulling just the O and Q out > of the list of letters for manipulation...instead it is adding "u" to all > the letters when combining with the suffix...apparently its due the fact > that O and Q are present in the entire "string"......anybody have some > suggestions for this??... It's not because "O and Q are present in the entire string" - it's because your expression prefixes == "O" or "Q" evaluates as (prefixes == "O") or ("Q") Since a string containing a value always evaluates as true, your expression was always true, too. -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/mailman/listinfo/python-list