8000 Add hints to coin toss challenge solutions · monkeyfx/python-basics-exercises@c160b44 · GitHub
[go: up one dir, main page]

Skip to content

Commit c160b44

Browse files
committed
Add hints to coin toss challenge solutions
1 parent 54fe530 commit c160b44

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

ch08-conditional-logic/9a-challenge.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
# Simulate the results of a series of coin tosses and track the results
66

7+
# This one is tricky to structure correctly. Try writing out the logic before you start coding. Some additional pointers if you're stuck:
8+
# 1. You will need to use a `for` loop over a range of trials.
9+
# 2. For each trial, first you should check the outcome of the first flip.
10+
# 3. Make sure you add the first flip to the total number of flips.
11+
# 4. After the first toss, you'll need another loop to keep flipping while you get the same result as the first flip.
12+
713
from random import randint
814

915
flips = 0

ch08-conditional-logic/9b-challenge.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
# Simulate the results of a series of coin tosses and track the results
66

7+
# This one is tricky to structure correctly. Try writing out the logic before you start coding. Some additional pointers if you're stuck:
8+
# 1. You will need to use a `for` loop over a range of trials.
9+
# 2. For each trial, first you should check the outcome of the first flip.
10+
# 3. Make sure you add the first flip to the total number of flips.
11+
# 4. After the first toss, you'll need another loop to keep flipping while you get the same result as the first flip.
12+
713
from random import randint
814

915

ch08-conditional-logic/9c-challenge.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
# Simulate the results of a series of coin tosses and track the results
66

7+
# This one is tricky to structure correctly. Try writing out the logic before you start coding. Some additional pointers if you're stuck:
8+
# 1. You will need to use a `for` loop over a range of trials.
9+
# 2. For each trial, first you should check the outcome of the first flip.
10+
# 3. Make sure you add the first flip to the total number of flips.
11+
# 4. After the first toss, you'll need another loop to keep flipping while you get the same result as the first flip.
12+
713
from random import randint
814

915

0 commit comments

Comments
 (0)
0