Intent is to print "Jack, Kack, ...." with "O" and "Q" delivering a longer 
suffix.  Instead, I get the printout shown with duplicates and a second 
deviation with "O" and "Q" as shown.
Why?  IDLE and Shell are Python 2.5.4 running on Windows 8.1.

prefixes = 'JKLMNOPQ'   ###FAILS WITH REPEATS
suffix = 'ack'
suffixb= 'uack'

for letter in prefixes:
    if letter == "O":
        print letter + suffixb
    if letter == "Q":
        print letter + suffixb
    else:
        print letter + suffix

>>> 
Jack
Jack
Kack
Kack
Lack
Lack
Mack
Mack
Nack
Nack
Ouack
Oack
Oack
Pack
Pack
Quack
Qack
>>> 

Thanks,  Ken Hammer

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

Reply via email to