Open study

is now brainly

With Brainly you can:

  • Get homework help from millions of students and moderators
  • Learn how to solve problems with step-by-step explanations
  • Share your knowledge and earn points by helping other students
  • Learn anywhere, anytime with the Brainly app!

A community for students.

Can anyone help out with the 1.8 exercises? I'm a bit stuck on both 3 and 4.

MIT 6.189 A Gentle Introduction to Programming Using Python (OCW)
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Join Brainly to access

this expert answer

SEE EXPERT ANSWER

To see the expert answer you'll need to create a free account at Brainly

!.8 q3 I haven't coded it yet, but an exponential is just repeated multiplication so a**3 is a*a*a It looks like the number of times the multiplication takes place could be controlled by the loop.
Thanks, I think I got the exp and base one, just working on the even number one now. I keep getting an infinite loop :)
If the while loop tests for an odd number, control should fall out of it when an even number is entered.?

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

Yeah, I get it to not be infinite now, but I believe it is supposed to keep asking you to enter an even number until you do, so that's all I have left, but I'll have to do that another day.
The thing is you need to ask for the number in TWO places. Once before you enter the loop and then once inside the loop. At least that's what I did.
The way I did it was I began by creating a test variable and setting it to False I then created a loop that ran while the test variable was False; in this loop, I prompted for the number, checked that it was even, and changed the test variable to True if it was. If the entry was something other than an even number, the test variable stayed False, the loop restarted, and the user was prompted again.
Thanks all for the help - I got it :)

Not the answer you are looking for?

Search for more explanations.

Ask your own question