Skip to content

Commit

Permalink
Change 'amount' to 'number' for countables (exercism#3526)
Browse files Browse the repository at this point in the history
This is a follow-up to exercism#3517

I've fixed the following occurrences:
- number of values
- number of digits
- number of function calls
- number of hours
- number of health points
- number of (intermediate) delivery points
- number of keyword arguments
- number of grains
- number of names

I have also verified that the following are correct:
- amount of reputation
- amount of work
- amount of functionality
- amount of memory
- amount of money
- amount of domestic currency
- amount of tree climbing
- amount of energy

[no important files changed]
  • Loading branch information
kytrinyx authored Oct 27, 2023
1 parent 358e406 commit 166a0d8
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 25 deletions.
12 changes: 6 additions & 6 deletions concepts/function-arguments/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ For instance, `*` is used for multiplication, it is used for unpacking, and it i
Since a tuple can be iterated, `args` can be passed to any other function which takes an iterable.
Although `*args` is commonly juxtaposed with `**kwargs`, it doesn't have to be.

Following is an example of an arbitrary amount of values being passed to a function:
Following is an example of an arbitrary number of values being passed to a function:

```python

Expand All @@ -196,7 +196,7 @@ Following is an example of an arbitrary amount of values being passed to a funct

If `*args` follows one or more positional arguments, then `*args` will be what is left over after the positional arguments.

Following is an example of an arbitrary amount of values being passed to a function after a positional argument:
Following is an example of an arbitrary number of values being passed to a function after a positional argument:

```python

Expand All @@ -210,7 +210,7 @@ Following is an example of an arbitrary amount of values being passed to a funct

If one or more default arguments are defined after `*args` they are separate from the `*args` values.

To put it all together is an example of an arbitrary amount of values being passed to a function that also has a positional argument and a default argument:
To put it all together is an example of an arbitrary number of values being passed to a function that also has a positional argument and a default argument:

```python

Expand All @@ -228,7 +228,7 @@ To put it all together is an example of an arbitrary amount of values being pass

```

Note that when an argument is already in an iterable, such as a tuple or list, it needs to be unpacked before being passed to a function that takes an arbitrary amount of separate arguments.
Note that when an argument is already in an iterable, such as a tuple or list, it needs to be unpacked before being passed to a function that takes an arbitrary number of separate arguments.
This is accomplished by using `*`, which is the [unpacking operator][unpacking operator].

`*` in this context _unpacks_ the container into its separate elements which are then transformed by `*args` into a tuple.
Expand Down Expand Up @@ -257,7 +257,7 @@ The `**` transforms the group of named arguments into a [`dictionary`][dictionar
Since a dictionary can be iterated, `kwargs` can be passed to any other function which takes an iterable.
Although `**kwargs` is commonly juxtaposed with `*args`, it doesn't have to be.

Following is an example of an arbitrary amount of key-value pairs being passed to a function:
Following is an example of an arbitrary number of key-value pairs being passed to a function:

```python
>>> def add(**kwargs):
Expand All @@ -271,7 +271,7 @@ Note that the `dict.values()` method is called to iterate through the `kwargs` d

When iterating a dictionary the default is to iterate the keys.

Following is an example of an arbitrary amount of key-value pairs being passed to a function that then iterates over `kwargs.keys()`:
Following is an example of an arbitrary number of key-value pairs being passed to a function that then iterates over `kwargs.keys()`:

```python
>>> def concat(**kwargs):
Expand Down
2 changes: 1 addition & 1 deletion concepts/numbers/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ This means calculations within `()` have the highest priority, followed by `**`,

## Precision & Representation

Integers in Python have [arbitrary precision][arbitrary-precision] -- the amount of digits is limited only by the available memory of the host system.
Integers in Python have [arbitrary precision][arbitrary-precision] -- the number of digits is limited only by the available memory of the host system.

Floating point numbers are usually implemented using a `double` in C (_15 decimal places of precision_), but will vary in representation based on the host system.
Complex numbers have a `real` and an `imaginary` part, both of which are represented by floating point numbers.
Expand Down
2 changes: 1 addition & 1 deletion concepts/recursion/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Recursion can be viewed as another way to loop/iterate.
And like looping, a Boolean expression or `True/False` test is used to know when to stop the recursive execution.
_Unlike_ looping, recursion without termination in Python cannot not run infinitely.
Values used in each function call are placed in their own frame on the Python interpreter stack.
If the total amount of function calls takes up more space than the stack has room for, it will result in an error.
If the total number of function calls takes up more space than the stack has room for, it will result in an error.

## Looping vs Recursive Implementation

Expand Down
2 changes: 1 addition & 1 deletion concepts/recursion/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ It can be viewed as another way to loop/iterate.
Like looping, a Boolean expression or `True/False` test is used to know when to stop the recursive execution.
_Unlike_ looping, recursion without termination in Python cannot not run infinitely.
Values used in each function call are placed in their own frame on the Python interpreter stack.
If the total amount of function calls takes up more space than the stack has room for, it will result in an error.
If the total number of function calls takes up more space than the stack has room for, it will result in an error.

```python
def print_increment(step, max_value):
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/electric-bill/.docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ This means calculations within `()` have the highest priority, followed by `**`,

## Precision & Representation

Integers in Python have [arbitrary precision][arbitrary-precision] -- the amount of digits is limited only by the available memory of the host system.
Integers in Python have [arbitrary precision][arbitrary-precision] -- the number of digits is limited only by the available memory of the host system.

Floating point numbers are usually implemented using a `double` in C (_15 decimal places of precision_), but will vary in representation based on the host system.
Complex numbers have a `real` and an `imaginary` part, both of which are represented by floating point numbers.
Expand Down
6 changes: 3 additions & 3 deletions exercises/concept/electric-bill/.meta/exemplar.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@


def get_extra_hours(hours):
"""Return the amount of hours.
"""Return the number of hours.
:param: hours: int - amount of hours.
:return: int - amount of "extra" hours.
:param: hours: int - number of hours.
:return: int - number of "extra" hours.
"""

return (hours + 3) % 24
Expand Down
6 changes: 3 additions & 3 deletions exercises/concept/electric-bill/electric_bill.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@


def get_extra_hours(hours):
"""Return the amount of hours.
"""Return the number of hours.
:param: hours: int - amount of hours.
:return: int - amount of "extra" hours.
:param: hours: int - number of hours.
:return: int - number of "extra" hours.
"""
pass

Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/ellens-alien-game/.meta/exemplar.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Alien:
(class)total_aliens_created: int
x_coordinate: int - Position on the x-axis.
y_coordinate: int - Position on the y-axis.
health: int - Amount of health points.
health: int - Number of health points.
Methods
-------
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/ellens-alien-game/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Alien:
(class)total_aliens_created: int
x_coordinate: int - Position on the x-axis.
y_coordinate: int - Position on the y-axis.
health: int - Amount of health points.
health: int - Number of health points.
Methods
-------
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/locomotive-engineer/.docs/hints.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

## 3. Add missing stops

- Using `**kwargs` as a function parameter will allow an arbitrary amount of keyword arguments to be passed.
- Using `**kwargs` as a function parameter will allow an arbitrary number of keyword arguments to be passed.
- Using `**<dict>` as an argument will unpack a dictionary into keyword arguments.
- You can put keyword arguments in a `{}` or `dict()`.
- To get the values out of a dictionary, you can use the `<dict>.values()` method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The function should then `return` a `list` with the modifications.

Now that all the wagon data is correct, Linus would like you to update the system's routing information.
Along a transport route, a train might make stops at a few different stations to pick up and/or drop off cargo.
Each journey could have a different amount of these intermediary delivery points.
Each journey could have a different number of these intermediary delivery points.
Your friend would like you to update the systems routing `dict` with any missing/additional delivery information.

Implement a function `add_missing_stops()` that accepts a routing `dict` followed by a variable number of keyword arguments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ For `total` we want all of the 64 bits set to `1` to get the sum of grains on al
The easy way to do this is to set the 65th bit to `1` and then subtract `1`.
To go back to our two-square example, if we can grow to three squares, then we can shift `1` two positions to the left for binary `100`,
which is decimal `4`.
By subtracting `1` we get `3`, which is the total amount of grains on the two squares.
By subtracting `1` we get `3`, which is the total number of grains on the two squares.

| Square | Binary Value | Decimal Value |
| ------- | ------------ | ------------- |
Expand Down
4 changes: 2 additions & 2 deletions exercises/practice/grains/.approaches/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Another approach is to use [`pow`][pow].

## General guidance

The key to solving Grains is to focus on each square having double the amount of grains as the square before it.
This means that the amount of grains grows exponentially.
The key to solving Grains is to focus on each square having double the number of grains as the square before it.
This means that the number of grains grows exponentially.
The first square has one grain, which is `2` to the power of `0`.
The second square has two grains, which is `2` to the power of `1`.
The third square has four grains, which is `2` to the power of `2`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ However, this has a huge startup memory and time cost, as 676,000 strings have t
For an approximate calculation, 676,000 strings * 5 characters / string * 1 byte / character gives 3380000 bytes or 3.38 MB of RAM - and that's just the memory aspect of it.
Sounds small, but it's relatively very expensive at the beginning.

Thus, this approach is inefficient in cases where only a small amount of names are needed _and_ the time to set/reset the robot isn't crucial.
Thus, this approach is inefficient in cases where only a small number of names are needed _and_ the time to set/reset the robot isn't crucial.

[random-seed]: https://docs.python.org/3/library/random.html#random.seed
[iter-and-next]: https://www.programiz.com/python-programming/methods/built-in/iter
[itertools-product]: https://www.hackerrank.com/challenges/itertools-product/problem
[itertools-product]: https://www.hackerrank.com/challenges/itertools-product/problem

0 comments on commit 166a0d8

Please sign in to comment.