A community for students.
Here's the question you clicked on:
 0 viewing
anonymous
 4 years ago
Somebody please help!
anonymous
 4 years ago
Somebody please help!

This Question is Closed

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0>>> 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
 4 years ago
Best ResponseYou've already chosen the best response.1Do you understand this program as it is ?

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0Ahhh.. I think I do, but I can I ask some dumb questions just in case?

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0ahhh, 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
 4 years ago
Best ResponseYou've already chosen the best response.0letter is character, you can add more than 1 character

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0?? so the word letter does have a significance?

maitre_kaio
 4 years ago
Best ResponseYou've already chosen the best response.1Before 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
 4 years ago
Best ResponseYou've already chosen the best response.1prefixes, 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
 4 years ago
Best ResponseYou've already chosen the best response.0ok! thanks! that clears that question up. so, how exactly does for work??

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0just 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
 4 years ago
Best ResponseYou've already chosen the best response.1yamaka, 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/NonProgrammer%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
 4 years ago
Best ResponseYou've already chosen the best response.0I'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
 4 years ago
Best ResponseYou've already chosen the best response.1OK, 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
 4 years ago
Best ResponseYou've already chosen the best response.0ohh!!! ok that makes sense, so that's why it say 'for letter in prefixes:' ok i got that now!! Thank you!

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0what book are you following, it should be written there about it

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0I'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
 4 years ago
Best ResponseYou've already chosen the best response.0you may try look at this book http://bit.ly/bzodNl i haven't read it but it looks promising :D
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.