[Tutor] new user question about while loops

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Wed Oct 26 10:07:01 CEST 2005



On Tue, 25 Oct 2005, Nick Eberle wrote:

>  My goal, create a program that flips a coin 100 times, at the end it
> says the number of times it flipped heads and flipped tails.

Hi Nick,

Do you might if we simplify the problem slightly?  Say that you're only
flipping the coin two times.  Can you write code to say how many times it
flips heads and tails?  Once you get that working, then modify that
program to do it for three coins, then four.

The idea is to try really small cases first, just so you get a better
sense of the problem.  From your initial code, it looks like you might be
getting stuck on another concept besides loops, so let's see if we can get
that cleared up first.

Please feel free to ask questions.  Good luck!



More information about the Tutor mailing list