Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

tanya53 Group Title

exercise 1.15, I get the problem and what prints out, but what is the sequence of numbers that the guy wants to print or what would the sequence be used for, second part of the exercise?

  • one year ago
  • one year ago

  • This Question is Open
  1. hook Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    I don’t completely understand which sequence you’re talking about, but I did find the Exercise 1.15 a lot more sensible when I did also the optional part of it.

    • one year ago
  2. andrew.m.higgs Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    I also struggled to understand what the program was intended to do. I guess this illustrates the importance of commenting code.

    • one year ago
  3. SJKramer Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Can you solve it just by using commenting code or do you need to tinker with the code as well?

    • one year ago
  4. andrew.m.higgs Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    I don think just commenting will do. Changing the while loop or putting in an if statement to break the while loop is the most likely. Having said that, it its difficult to "fix" the code when we don't really know what the hoped for outcome is.

    • one year ago
  5. petew71 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    I wasn't sure on this? I assumed that because there was a' %2==0' and an' i/2', it was something to do with even numbers. But what about n? I made it so i printed even numbers 10 down to 2. And n printed odd numbers 3 up to 9....Just as an experiment.

    • one year ago
  6. hook Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    I see two possible solutions for the buggy loop: (v1) counts down 'n' to make 10 iterations, while the second (v2) makes 'i' smaller by 1 each time it’s odd, and therefore reaches 0 and breaks the loop.

    • one year ago
  7. thoughtcrimes Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Yes, it runs as an infinite loop the way it is written, and never uses the N = 10 variable. So, you could use the N as a counter to how many times to run the code, or figure out what the code might be trying to do differently. It kind of reminds me of the square root problem discussed in one of the videos.

    • one year ago
    • Attachments:

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