diff --git a/concepts/bools/about.md b/concepts/bools/about.md index 0b8354750a3..7015fdfafa4 100644 --- a/concepts/bools/about.md +++ b/concepts/bools/about.md @@ -22,10 +22,10 @@ Each of the operators has a different precedence, where `not` is evaluated befor Brackets can be used to evaluate one part of the expression before the others: ```python ->>>not True and True +>>> not True and True False ->>>not (True and False) +>>> not (True and False) True ``` @@ -45,25 +45,25 @@ A few `built-ins` are always considered `False` by definition: ```python ->>>bool(None) +>>> bool(None) False ->>>bool(1) +>>> bool(1) True ->>>bool(0) +>>> bool(0) False ->>>bool([1,2,3]) +>>> bool([1,2,3]) True ->>>bool([]) +>>> bool([]) False ->>>bool({"Pig" : 1, "Cow": 3}) +>>> bool({"Pig" : 1, "Cow": 3}) True ->>>bool({}) +>>> bool({}) False ``` @@ -95,10 +95,10 @@ The `bool` type is implemented as a _sub-type_ of _int_. ```python ->>>1 == True +>>> 1 == True True ->>>0 == False +>>> 0 == False True ``` @@ -106,14 +106,14 @@ However, `bools` are **still different** from `ints`, as noted when comparing th ```python ->>>1 is True +>>> 1 is True False ->>>0 is False +>>> 0 is False False ``` -> Note: in python >= 3.8, using a literal (such as 1, '', [], or {}) on the _left side_ of `is` will raise a warning. +> Note: in python >= 3.8, using a literal (such as `1`, `''`, `[]`, or `{}`) on the _left side_ of `is` will raise a warning. It is considered a [Python anti-pattern][comparing to true in the wrong way] to use the equality operator to compare a boolean variable to `True` or `False`. diff --git a/concepts/numbers/about.md b/concepts/numbers/about.md index 1155bcf7a5c..3fa63c140d9 100644 --- a/concepts/numbers/about.md +++ b/concepts/numbers/about.md @@ -135,7 +135,7 @@ Numbers can be converted from `int` to `floats` and `floats` to `int` using the ## Round -Python provides a built-in function [`round(number, )`][round] to round off a floating point number to a given number of decimal places. +Python provides a built-in function [`round(, )`][round] to round off a floating point number to a given number of decimal places. If no number of decimal places is specified, the number is rounded off to the nearest integer and will return an `int`: ```python diff --git a/exercises/concept/currency-exchange/.meta/exemplar.py b/exercises/concept/currency-exchange/.meta/exemplar.py index c7e497bbe15..d835bce65c3 100644 --- a/exercises/concept/currency-exchange/.meta/exemplar.py +++ b/exercises/concept/currency-exchange/.meta/exemplar.py @@ -40,7 +40,7 @@ def get_change(budget, exchanging_value): float: The amount left of your starting currency after the exchange Examples: - .>>> get_change(127.5, 120.0) + >>> get_change(127.5, 120.0) 7.5 >>> get_change(300.75, 150.25) diff --git a/exercises/concept/currency-exchange/exchange.py b/exercises/concept/currency-exchange/exchange.py index 8d4cce6cf1d..c135c33beb9 100644 --- a/exercises/concept/currency-exchange/exchange.py +++ b/exercises/concept/currency-exchange/exchange.py @@ -42,7 +42,7 @@ def get_change(budget, exchanging_value): float: The amount left of your starting currency after the exchange Examples: - .>>> get_change(127.5, 120.0) + >>> get_change(127.5, 120.0) 7.5 >>> get_change(300.75, 150.25)