Ask your own question, for FREE!
MIT 6.189 A Gentle Introduction to Programming Using Python (OCW) 8 Online
OpenStudy (anonymous):

MOOC handout 2 sec 2.10 (#2) Write a list comprehension that prints out the possible results of two coin flips (one result would be ’ht’). I'm stuck on how to even begin this code, I know that it should output 4 different results (ht,tt,hh,th) but that is it. Could anyone give me a hint?

OpenStudy (anonymous):

A hint: You need an inner and outer loop in the list comprehension - with the outer loop controlling one of the flips and the inner loop controlling the other.

OpenStudy (anonymous):

awesome, got it..didn't think it would be that easy! thank you

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!