Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 15 Online
OpenStudy (anonymous):

prefixes = "JKLMNOPQ" suffix = "ack" for letter in prefixes: if prefixes == "O": print "Ou" + suffix elif prefixes == "Q": print "Qu" + suffix else: print letter + suffix I'm trying to get this print out, but I can't get it....can someone help? Jack Kack Lack Mack Nack Ouack Pack Quack

OpenStudy (anonymous):

just go to the print box on the to right of the screen and click it.

OpenStudy (anonymous):

I'm not sure I understand....what do I need to change?

OpenStudy (anonymous):

prefix = 'jklmn' suffix = 'ack' for pre in range(len(prefix)): print(prefix[pre]+suffix)

OpenStudy (microbot):

@danmei in your code : if prefixes == "O": do smthing you have to write: if letter == "O": do smthing same for your other if statements. cause as you have it right now , the if and elif conditions are always false, since prefixes is "JKLMNOPQ" and not just one letter. And since if and elif are false, it jumps to the else statement and prints every letter of prefixes +suffix. hope it helps

OpenStudy (anonymous):

Thanks MicroBot, that helped.

OpenStudy (microbot):

im happy it did!:)

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!