Computer Science Principles: Unit 5/Lesson 12 problems

Just can’t seem to get successful code created for Unit 5/Lesson 12’s bubble 4. Here’s my code that worked for bubble 3:

var count = 0;
while (count <= 9) {
write(randomNumber(0,1));
count=count+1;
}

If anyone has code that works in bubble 4, seeing it would help a bunch!

Hi,

So it looks like you need to check IF your coin flip is a heads or not, and then use that to update a “heads” counter (which will be different from your count variable). Be sure to note that each time you call randomNumber it will produce a new value…so be careful how you set up your check.

Hope that helps!

Absolutely … any chance you have the code available? I’ve tried a number of angles on this, but yet to make it run properly

@ifidler there is a Example Solution available in the Teacher’s Panel. It should provide the information you need.

1 Like

Found it … many thanks!

Great! Glad to help. Almost all of the programming assignments have example solutions. I do recommend that teachers “live the student experience” and try and complete the coding on their on own but when in doubt the Example Solutions are there for you.

1 Like