From 921dc7d612c07d3358858a0820471da0bfe30225 Mon Sep 17 00:00:00 2001 From: martin-martin Date: Wed, 2 Aug 2023 12:58:04 +0200 Subject: [PATCH 1/2] Fix typos in comments --- ch08-conditional-logic/6-recover-from-errors.py | 2 +- .../8b-challenge-simulate-a-coin-toss-experiment.py | 2 +- .../8c-challenge-simulate-a-coin-toss-experiment.py | 4 ++-- ch08-conditional-logic/9a-challenge-simulate-an-election.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ch08-conditional-logic/6-recover-from-errors.py b/ch08-conditional-logic/6-recover-from-errors.py index 157536d..250144b 100644 --- a/ch08-conditional-logic/6-recover-from-errors.py +++ b/ch08-conditional-logic/6-recover-from-errors.py @@ -15,7 +15,7 @@ # Exercise 2 -# Print character and specifid index in string +# Print character and specified index in string input_string = input("Enter a string: ") diff --git a/ch08-conditional-logic/8b-challenge-simulate-a-coin-toss-experiment.py b/ch08-conditional-logic/8b-challenge-simulate-a-coin-toss-experiment.py index a01a8ce..9f3effe 100644 --- a/ch08-conditional-logic/8b-challenge-simulate-a-coin-toss-experiment.py +++ b/ch08-conditional-logic/8b-challenge-simulate-a-coin-toss-experiment.py @@ -31,7 +31,7 @@ def coin_flip(): first_flip = coin_flip() flips = flips + 1 # Continue flipping the coin and updating the tally until - # a different result is returned by coin_flips() + # a different result is returned by coin_flip() while coin_flip() == first_flip: flips = flips + 1 # Increment the flip tally once more to account for the diff --git a/ch08-conditional-logic/8c-challenge-simulate-a-coin-toss-experiment.py b/ch08-conditional-logic/8c-challenge-simulate-a-coin-toss-experiment.py index 5d1e075..753e91d 100644 --- a/ch08-conditional-logic/8c-challenge-simulate-a-coin-toss-experiment.py +++ b/ch08-conditional-logic/8c-challenge-simulate-a-coin-toss-experiment.py @@ -16,9 +16,9 @@ def single_trial(): - """Simulate repeatedly a coing until both heads and tails are seen.""" + """Simulate repeatedly flipping a coin until both heads and tails are seen.""" # This function uses random.randint() to simulate a single coin toss. - # randing(0, 1) randomly returns 0 or 1 with equal probability. We can + # randint(0, 1) randomly returns 0 or 1 with equal probability. We can # use 0 to represent heads and 1 to represent tails. # Flip the coin the first time diff --git a/ch08-conditional-logic/9a-challenge-simulate-an-election.py b/ch08-conditional-logic/9a-challenge-simulate-an-election.py index 2b46837..a9ef523 100644 --- a/ch08-conditional-logic/9a-challenge-simulate-an-election.py +++ b/ch08-conditional-logic/9a-challenge-simulate-an-election.py @@ -26,7 +26,7 @@ else: votes_for_B = votes_for_B + 1 - # Determine who wins the erd region + # Determine who wins the 3rd region if random() < 0.17: votes_for_A = votes_for_A + 1 else: From d65ea99c4bfac477e0d94c3450a2ba02480bc8be Mon Sep 17 00:00:00 2001 From: martin-martin Date: Wed, 2 Aug 2023 13:03:08 +0200 Subject: [PATCH 2/2] One more typo --- .../7-simulate-events-and-calculate-probabilities.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ch08-conditional-logic/7-simulate-events-and-calculate-probabilities.py b/ch08-conditional-logic/7-simulate-events-and-calculate-probabilities.py index 29de41f..d7b939f 100644 --- a/ch08-conditional-logic/7-simulate-events-and-calculate-probabilities.py +++ b/ch08-conditional-logic/7-simulate-events-and-calculate-probabilities.py @@ -6,7 +6,7 @@ # Exercise 1 -# Write a function that simulatee the roll of a die. +# Write a function that simulates the roll of a die. def roll(): """Return random integer between 1 and 6""" return randint(1, 6) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy