|
|
|
@ -2,26 +2,20 @@
|
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
|
|
|
|
|
|
In this exercise a number between 0 and 1000000 will be generated. |
|
|
|
|
Your purpose is to create the function `spell` that will spell the numbers generated. |
|
|
|
|
In this exercise, you'll create the function `spell` that will spell a generated number. |
|
|
|
|
|
|
|
|
|
So, if the program generates the number: |
|
|
|
|
Here are some examples of what your function should return: |
|
|
|
|
|
|
|
|
|
- 1 your function will return the string "one" |
|
|
|
|
- 14 your function will return the string "fourteen". |
|
|
|
|
- 96 your function will return the string "ninety-six" |
|
|
|
|
- 100 your function will return the string "one hundred". |
|
|
|
|
- 101 your function will return the string "one hundred one" |
|
|
|
|
- 348 your function will return the string "one hundred twenty-three" |
|
|
|
|
- 1002 your function will return the string "one thousand two". |
|
|
|
|
- 1000000 your function will return the string "one million" |
|
|
|
|
|
|
|
|
|
Only positive numbers will be tested. (Up to a million). |
|
|
|
|
|
|
|
|
|
### Notions |
|
|
|
|
|
|
|
|
|
- [patterns](https://doc.rust-lang.org/book/ch18-00-patterns.html) |
|
|
|
|
- `1` -> `"one"` |
|
|
|
|
- `14` -> `"fourteen".` |
|
|
|
|
- `96` -> `"ninety-six"` |
|
|
|
|
- `100` -> `"one hundred".` |
|
|
|
|
- `101` -> `"one hundred one"` |
|
|
|
|
- `348` -> `"one hundred twenty-three"` |
|
|
|
|
- `1002` -> `"one thousand two".` |
|
|
|
|
- `1000000` -> `"one million"` |
|
|
|
|
|
|
|
|
|
> Only positive numbers will be tested, up to `"one million"`. |
|
|
|
|
|
|
|
|
|
### Expected function |
|
|
|
|
|
|
|
|
@ -52,3 +46,7 @@ three hundred forty-eight
|
|
|
|
|
nine thousand nine hundred ninety-six |
|
|
|
|
$ |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
### Notions |
|
|
|
|
|
|
|
|
|
- [patterns](https://doc.rust-lang.org/book/ch18-00-patterns.html) |
|
|
|
|