Timeline for Determine the chance a streak of 6 HEADs or 6 TAILS appear in 100 flips, repeated 10000 times
Current License: CC BY-SA 4.0
15 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 9, 2023 at 17:50 | comment | added | Nova | I appreciate your help. I totally understand the use of and but your specific usage here seems like an odd case. None of scenarios in both the article you gave me answered my question. They covered all the basics I'm already familiar with. But you've helped me enough, so I won't be bothering you further on this issue. Thank you. | |
May 9, 2023 at 17:28 | comment | added | Kache | btw these additional questions of yours are commonly asked and should be easy to find either on Google or on StackOverflow. | |
May 9, 2023 at 17:24 | comment | added | Kache | it's a commonly used combination of these two concepts: freecodecamp.org/news/truthy-and-falsy-values-in-python and freecodecamp.org/news/… | |
May 9, 2023 at 16:36 | comment | added | Nova | Thank you, I understand that. What I don't understand is how you can assign a variable this way. The syntax looks weird to a newbie like me. If it's prev_side = streaks[-1][-1] then we get an out of index error because at the start of the loop, streak is an empty list. But then you add streaks and and suddenly it's okay? What does this 'streaks and' mean. Why 'and' here? ` | |
May 9, 2023 at 16:29 | comment | added | Kache |
streaks looks something like: [[1, 1], [0, 0, 0], [1], [0, 0]] . streaks[-1] is the last element of that, [0, 0] . streaks[-1][-1] is the last element of that, 0 .
|
|
May 9, 2023 at 14:47 | comment | added | Nova | Hi, I'm reviewing the solution of this exercise. Could you help me understand this: prev_side = streaks and streaks[-1][-1] . What is happening here? Thank you | |
May 8, 2023 at 18:28 | comment | added | Kache | Again, dividing the final count by 100 doesn't really make sense. Perhaps the 100 was the "dividing by the number of trials" to get the average, which you've already done. | |
May 5, 2023 at 22:21 | comment | added | Nova | thanks! I calculated number of streaks in each trial, then got the average of streaks across all trials, divided by 100. Now the chance is super low ~0.015% .It makes more sense now | |
May 5, 2023 at 22:14 | vote | accept | Nova | ||
May 5, 2023 at 21:50 | comment | added | Kache | Whoops, forgot to mention that part. Added another section to #Logical | |
May 5, 2023 at 21:50 | history | edited | Kache | CC BY-SA 4.0 |
added 419 characters in body
|
May 5, 2023 at 21:30 | comment | added | Nova | Thank you so much for the very detailed and thorough answer. | Does a streak of 12 H mean 2 streaks? ----> Yes. Because the problem was asking for streaks of 6 I don't get this part either: 'print('Chance of streak: %s%%' % (numberOfStreaks / 100)) ' . It took me a few times to have an idea how the list grouping works and the logic of what's going on in that 'for' loop you wrote. That was very educational. And I love your 'nicer' code suggestions too. Did you think my results were off? Why are the chances so high? | |
May 5, 2023 at 18:42 | history | edited | Kache | CC BY-SA 4.0 |
added 2 characters in body
|
May 5, 2023 at 18:30 | history | edited | Kache | CC BY-SA 4.0 |
added 376 characters in body
|
May 5, 2023 at 18:08 | history | answered | Kache | CC BY-SA 4.0 |