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

This Question is Open

hook Group TitleBest ResponseYou've already chosen the best response.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.
 2 years ago

andrew.m.higgs Group TitleBest ResponseYou've already chosen the best response.1
I also struggled to understand what the program was intended to do. I guess this illustrates the importance of commenting code.
 2 years ago

SJKramer Group TitleBest ResponseYou've already chosen the best response.0
Can you solve it just by using commenting code or do you need to tinker with the code as well?
 2 years ago

andrew.m.higgs Group TitleBest ResponseYou've already chosen the best response.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.
 2 years ago

petew71 Group TitleBest ResponseYou've already chosen the best response.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.
 2 years ago

hook Group TitleBest ResponseYou've already chosen the best response.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.
 2 years ago

thoughtcrimes Group TitleBest ResponseYou've already chosen the best response.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.
 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.