Got Homework?
Connect with other students for help. It's a free community.
Here's the question you clicked on:
 0 viewing
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."
 2 years ago
 2 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."
 2 years ago
 2 years ago

This Question is Closed

JulieNewbieBest ResponseYou've already chosen the best response.0
Apparently 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?
 2 years ago

AdisABest ResponseYou've already chosen the best response.0
I 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
 2 years ago

bwCABest ResponseYou've already chosen the best response.1
you 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'
 2 years ago

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

JulieNewbieBest ResponseYou've already chosen the best response.0
I 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...)
 2 years ago

JulieNewbieBest ResponseYou've already chosen the best response.0
Something 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.
 2 years ago

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

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

bwCABest ResponseYou've already chosen the best response.1
i 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.
 2 years ago

JulieNewbieBest ResponseYou've already chosen the best response.0
Interesting. 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.
 2 years ago
See more questions >>>
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.