A community for students. Sign up today!
Here's the question you clicked on:
 0 viewing
 2 years ago
Hey this is where I am... problem set 2 (1) My thought was to call a function that determined the length of the tuple  used that information to create an empty list that would than dump the data from the tuple into the list. Call each element in the list and apply their corresponding powers.
I'm thinking I need some sort of while or for statement that takes the tuple length and creates the powers. Am I on the right track? I know I could make this super simple but I assumed the point was create a polynomial function that could have a varied length... Sorry about my math vernacular.
 2 years ago
Hey this is where I am... problem set 2 (1) My thought was to call a function that determined the length of the tuple  used that information to create an empty list that would than dump the data from the tuple into the list. Call each element in the list and apply their corresponding powers. I'm thinking I need some sort of while or for statement that takes the tuple length and creates the powers. Am I on the right track? I know I could make this super simple but I assumed the point was create a polynomial function that could have a varied length... Sorry about my math vernacular.

This Question is Closed

Ante
 2 years ago
Best ResponseYou've already chosen the best response.0You're on the right track but you're also making it a bit more complicated than it should be. "For" is a good direction and use the indexes to access tuple elements. Applying powers and accumulating the results shouldnt be hard then.

shawnf
 2 years ago
Best ResponseYou've already chosen the best response.0for i in range(len(tuple)): list[i] = tuple[i] will give you a list, but I think the only advantage here is that you can change the list values directly. there is also a one line version list = [element for i in range(len(tuple))]

PatrickD
 2 years ago
Best ResponseYou've already chosen the best response.0On the third problem do you want to embed the function you created in the first problem?

PatrickD
 2 years ago
Best ResponseYou've already chosen the best response.0Ok i'm still struggling with this code  I think it's basically because I'm not writing the functions correctly. But I can't seem to add or change the list via call the locationn in the list. while guessedValue == k: print 'got here' print rangeBegin print unguessList unguessList = unguessList.insert(rangeBegin,guessedValue) print unguessList del unguessList[rangeBegin:rangeBegin] if guessedValue == k: guessCorrect = 1 else: guessCorrect = 0 All I want is for list to be checked and if it matches remove the '*" and add the called letter. There seems to be no embedded function that does this...

Gianko15
 2 years ago
Best ResponseYou've already chosen the best response.1You don't need to do this: for i in range(len(tuple)): list[i] = tuple[i] use list = tuple [:] (clonning) You're using tuples, use them to simplify your task, take one for the letters of the word, another one with the wrong guess, and another with the good guess, using that tuples you can make a cleaner comparison; and I think that another definition about list_maker can be avoided, but it's ok anyway.

PatrickD
 2 years ago
Best ResponseYou've already chosen the best response.0if i do that won't that just insert the entire tuple into the spot [o] on the list?

Gianko15
 2 years ago
Best ResponseYou've already chosen the best response.1no, doing this "list = tuple [:]" will be exactly the same, and if you do list == tuple, will say True. if you do, for list[i] = tuple[i]; will look the same, but list == tuple, will say False

PatrickD
 2 years ago
Best ResponseYou've already chosen the best response.0so i want to use (ex. list_sample = tuple_sample[:]) this will create list that is identical (for all intents and purposes to a tuple)

Gianko15
 2 years ago
Best ResponseYou've already chosen the best response.1that's what I'm saying, clonning, why don't you try it on your Python shell so can be more familiar.

PatrickD
 2 years ago
Best ResponseYou've already chosen the best response.0will do this should make things a bit easier :) thanks!
Ask your own question
Ask a QuestionFind 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.