anonymous
  • anonymous
Somebody please help!
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
>>> prefixes=('JKLMNOPQ') >>> suffix=('ack') >>> for letter in prefixes: print (letter + suffix) Jack Kack Lack Mack Nack Oack Pack Qack >>> #The question they are asking is how to modify this program for the prefixes so that 'u' would be added in between 'O' and 'ack' and 'Q' and 'ack' to create Ouack and Quack. Please help me. Thanks!!
maitre_kaio
  • maitre_kaio
Do you understand this program as it is ?
anonymous
  • anonymous
use conditionals

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
Ahhh.. I think I do, but I can I ask some dumb questions just in case?
maitre_kaio
  • maitre_kaio
sure
anonymous
  • anonymous
thanks!
anonymous
  • anonymous
ahhh, so the word letter does not matter at all does it? its just used to understand that we're taking a letter but it could be any other word right?
anonymous
  • anonymous
letter is character, you can add more than 1 character
anonymous
  • anonymous
?? so the word letter does have a significance?
maitre_kaio
  • maitre_kaio
Before starting to code, try to imagine in your own words what you want to do. I would say, for this problem: for each prefix, I want to append the suffix. If the prefix is 'O' or 'Q', I also want to add 'u' between the prefix and the suffix. If you read that carefully, you will see that the code is mostly done.
maitre_kaio
  • maitre_kaio
prefixes, suffixe, letter are simply variable names. They could have been named foo, bar and maitre_kaio, doesn't matter for the interpreter. But it DOES matter for us, humans, because good variable names help us to understand the code.
anonymous
  • anonymous
ok! thanks! that clears that question up. so, how exactly does for work??
anonymous
  • anonymous
just by saying for it takes each letter? is that the function? is that the only function it has? Can it be used in a different way then "for letter in prefixes:"?
maitre_kaio
  • maitre_kaio
yamaka, I don't want to be rude but have you read anything about the basic structures of Python ? If not, please check that one: http://en.wikibooks.org/wiki/Non-Programmer%27s_Tutorial_for_Python_2.6 Because you probably understand that we can't write a full Python tutorial here. If you have already read some references, please ask more accurately what you don't understand
anonymous
  • anonymous
I'm sorry, I read the text book and how it's supposed to work, but it just doesn't seem to be clicking for this 'for' concept.
maitre_kaio
  • maitre_kaio
OK, imagine you have a collection of elements. They may be of any type (integers, float, string, ....). You want to do something with each of them. Or should I say: for each element in set: do something
anonymous
  • anonymous
yes!
anonymous
  • anonymous
ohh!!! ok that makes sense, so that's why it say 'for letter in prefixes:' ok i got that now!! Thank you!
anonymous
  • anonymous
what book are you following, it should be written there about it
anonymous
  • anonymous
I'm following the "How to think like a computer scientist", but it says it in such a way that i didn't get the part about elements...probably just lack of understanding on my part tho X(
anonymous
  • anonymous
you may try look at this book http://bit.ly/bzodNl i haven't read it but it looks promising :D
anonymous
  • anonymous
Thank you Tomas XD

Looking for something else?

Not the answer you are looking for? Search for more explanations.