A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 5 years ago

Problem Set 2, #3

  • This Question is Closed
  1. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    1 Attachment
  2. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    for some reason it isnt working, when launched it just remains a blank screen

  3. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I just did it this morning. I'll take a look at it.

  4. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    The only I see wrong right off the back is you never assigned in in your test statement to fix that you can add 1 argument to your test function which would be n. I'm going to try it now and tell you if it works.

  5. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    You also didn't assign count in test(). I don't understand what you were trying to do with count in test I don't think those do anything

  6. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    ok wait let me upload my most recent one

    1 Attachment
  7. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    ok sorry some indentation issues...heres the most recent one, it just returns -5

    1 Attachment
  8. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    ok still in test you are not giving it an argument therefore n is not assigned inside the function test(). Your argument should be test(n).

  9. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    ok now it just returns -5 once...i guess thats an improvement

  10. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    In your test function the body of your else statement should be even with "for a in range(0,n)" because the way yours is setup it will only check the first possible solution in stead of all solutions in (0,n) and would you rather me explain everything or post a fixed code.

  11. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    can you please post a fixed code then if i have any questions ill ask you?

  12. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Yea one sec lemme do it really quick.

  13. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    and i know some people use tuples or lists on this problem, thats not needed right?

  14. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    No it can be done either way http://dpaste.com/hold/529001/

  15. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Do you want to see it done with a list?

  16. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    no thanks, i havent tried it yet so i'd rather attempt on my own but thanks for all the help!

  17. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    so basically i just had to get rid of the else statement because it was causing it to check for only one value?

  18. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    you had to add the argument to test which was test(n). I deleted the print n-5 in test there was no point to it. Your return n-5 should only be return n. I also deleted your n=0 its outside the function and isn't doing anything.

  19. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    sorry I forgot to comment out the wrong stuff instead of deleting it.

  20. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    its fine i understood it all, main thing was deleting the else statement...but why exactly do i need an arguement for test?

  21. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    try it without the arguments you get a name error because functions have local variables. so unless you tell it to take an argument none of the variables you are already using will carry over. Therefor the n in cheese() will not moved to test() unless you tell it to by putting test(n).

  22. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Did that help?

  23. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    yeah thanks

  24. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    thanks btw im 16 so we are the young ones of this school lolz

  25. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Yeah, no problem and thats cool haha I'll be 16 in June.

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

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

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
  • 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.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.