A community for students.
Here's the question you clicked on:
 0 viewing
anonymous
 4 years ago
I'm working on PS3, part 3. I can't say I understand the question. Can anyone help me out?
The problem states "Write a function (called constrainedMatchPair) which takes three arguments: a tuple representing starting points for the first substring, a tuple representing starting points for the second substring, and the length of the first substring. The function should return a tuple of all members (call it n) of the first tuple for which there is an element in the second tuple (call it k) such that n+m+1 = k, where m is the length of the first substring."
anonymous
 4 years ago
I'm working on PS3, part 3. I can't say I understand the question. Can anyone help me out? The problem states "Write a function (called constrainedMatchPair) which takes three arguments: a tuple representing starting points for the first substring, a tuple representing starting points for the second substring, and the length of the first substring. The function should return a tuple of all members (call it n) of the first tuple for which there is an element in the second tuple (call it k) such that n+m+1 = k, where m is the length of the first substring."

This Question is Closed

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0Apparently I'm verbose; my question wouldn't fit in the space provided. So here's the rest of it. So is this correct? n= a tuple representing starting points for the first substring, k= a tuple representing starting points for the second substring, m= the length of the first substring. If anyone has completed this part of the PS3 set, could you please post it?

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0I also haven't written that function, because misunderstanding of the problem. I was trying all evening to understand that problem, but I didn't get it. I think if anyone explains you the problem in little simpler way, you will get it. Here is solution for all problem sets, from one of the member of this study group: http://proficiamus.blogspot.com

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0you are correct, JulieNewbie, about constrainedMatchPair arguments for each element in n is there an element in k that meets the equation. if there is, then 'save' this (n) element. when you are done checking all the elements in n, return all the elements that were 'saved'

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0I'm having the same issue here. I don't understand what this function is supposed to return.

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0I can tell you what it's supposed to return. You're trying to find nearmatches to your key string inside of the target string. So you break the key into two parts (key1 and key2), search for those, then use the equation n+m+1 = k to find nearmatches of the entire key. Then you report these nearmatches by printing a tuple of the starting indices of each nearmatch inside of the target. So an example would be match ATGC against ATGACATGCACAAGTATGCAT You can see that the firs 4 indices of the target are "ATGA" which is the same as the key except it has one substitution. So you would create a list to save "0" because the nearmatch starts at index 0. You add to this list all the starting points of other nearmatches, which would spit out [0, 5, 15] for this example. ( I think... I did it by looking at it as opposed to running the script I haven't written yet...)

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0Something else I'm hung up on is this: they say in the assignment to report tuples. However, tuples are immutable, so how in the world can I iterate through the string & keep track of the answers? Seems to me the only option is to create a list.

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0use the tuple function to turn the list you have been working with into a tuple return tuple(myList)

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0O. M. G. It's that easy??? What would I do without this study group?

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0i really don't know what the consequences are, i/we haven't been working with very large data sets. but it is so easy to change data types back and forth, if i need to do something i look for methods in other data types and see if i can make it work.

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0Interesting. I read somewhere (in the readings for this class) that mutable lists leave your code vulnerable to malware, so tuples would be more secure. However, if the data types are so easy to change, then it wouldn't matter anyway.
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.