Need Help on HW2 6 and 7

I really have no previous programming experience and these two are impossible for me to do. I don't know where you post the solutions for quizzes and homeworks, so I don't know how to fix the ones I got wrong in Unit 1. Also, I don't get how to do print all links, Unit 2, Question for Lesson 30.
Thanks for any help you can give.

asked 05 Mar '12, 17:27

Noobie's gravatar image

Noobie
10114
accept rate: 0%

edited 05 Mar '12, 17:29


3 Answers:

Solutions for quizzes are in the video right after the quiz and are available all the time. Solutions for homeworks are in the vide right after the homework, but they are (naturally) available only after the homework's deadline.

Regarding help, I hope I will not cross the line of the policy if I will tell you:

hw6: Try to think about the exact steps you do, when you are presented with the same problem. Think about a loop you are doing and which data you mark down during each iteration. I do not want to post exact steps neither in words nor in code, though.

hw7: Think about the sentence being said at 1:10 of the homework video. For the first try, just print out numbers from one to n and then elaborate your code to do what the homework wants. However, this is "two-star" problem, thus don't be disappointed if you do not get it right if you are complete newbie as you write. This question might look pretty trivial for programmer with at least some experience, but I saw in practice, while lecturing C++ to complete newbies, that this one is really really tough for real beginner.

link

answered 05 Mar '12, 17:38

Marek%20B%C3%A1lint's gravatar image

Marek Bálint
4.7k164285

Thank you, you are a great help.

(05 Mar '12, 19:48) Noobie Noobie's gravatar image

I really had to scratch my head for a while on question 7. David Evans gives a clue at the end of the video to question 7 about using a while-statement within a while-statement. I figured out how to output 1 x 1 = 1, 1 x 2 = 2, 1 x 3 = 3, but that's where my procedure ended at that point. I needed a way to continue my table to the next set of numbers, 2 x 1 = 2, 2 x 2 = 4, 2 x 3 = 6. I knew a while-statement within the while-statement could probably accomplish this, but how would I do it? The light bulb went on when I rewatched Unit 2.22's video at 2 minutes 17 seconds in with regards to 'i'. It then only took me a few minutes to finish up my procedure and submit my answer.

link

answered 05 Mar '12, 20:33

Glenn%20Hanna's gravatar image

Glenn Hanna
88431222

Regarding Unit 2, Question for Lesson 30:
Look at the if and else.

What does the 'if' code block do? Because you are inside while, this part of the code will repeat as long as 'if url:' is true. 'If url:" is false, then else is triggered and you need to code some action.

What do you want else to do?

All of this is happening as long as the test condition in while is met. So what kind of test condition do you want?

Think about this, because next up is a big hint and maybe you don't want to read it, maybe you want to work this out by yourself without any hints.

Analogous: While I'm hungry, if there's food then I'll eat and get a bit fuller. Else break (because in this analogy, I have run out of food). So in this example I will run out of food and the code will stop. Note the role that while plays in this analogy.

I hope this helps and isn't too answer-y.

link

answered 07 Mar '12, 00:01

isabelk's gravatar image

isabelk
5801623

Your answer
Question text:

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×15,292
×1,718
×423
×178
×161

Asked: 05 Mar '12, 17:27

Seen: 349 times

Last updated: 07 Mar '12, 00:01