-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Lucians luscious lasagna exercise (#14)
* add spellcheck * format test.yml * format md files with prettier * fix spellcheck issues in sh files * enable passing a single exercise to verify-exercises + add exit 1 on cd * refactor shell scripts * use markdownlint-cli (instead of v2) + fix arm. num md file * Add Lucians Luscious Lasagna exercise
- Loading branch information
Nenad Misić
authored
Jun 20, 2024
1 parent
adb479f
commit d3b1b33
Showing
18 changed files
with
435 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
|
||
markdownlint_cli_args="$1" | ||
|
||
npx markdownlint-cli2 \ | ||
$markdownlint_cli_args \ | ||
docs/*.md \ | ||
concepts/**/*.md \ | ||
exercises/**/*.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
exercises/practice/lucians-luscious-lasagna/.docs/hints.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Hints | ||
|
||
## General | ||
|
||
- An integer literal can be defined as one or more consecutive digits. | ||
|
||
## 1. Define the expected oven time in minutes | ||
|
||
- You need to define a [function][functions] without any parameters. | ||
|
||
## 2. Calculate the remaining oven time in minutes | ||
|
||
- You need to define a [function][functions] with a single parameter. | ||
- You can use and refer to the previously defined item by its name. | ||
- The last expression in a function is [automatically returned][return-values] | ||
from the function; you don't have to explicitly indicate which value to | ||
return. | ||
- You can use the [mathematical operator for subtraction][operators] to | ||
subtract values. | ||
|
||
## 3. Calculate the preparation time in minutes | ||
|
||
- You need to define a [function][functions] with a single parameter. | ||
- You can use the [mathematical operator for multiplication][operators] to | ||
multiply values. | ||
|
||
## 4. Calculate the elapsed time in minutes | ||
|
||
- You need to define a [function][functions] with two parameters. | ||
- You can [call][functions] one of the other functions you've defined | ||
previously. | ||
- You can use the [mathematical operator for addition][operators] to add | ||
values. | ||
|
||
[functions]: https://book.cairo-lang.org/ch02-03-functions.html | ||
[return-values]: https://book.cairo-lang.org/ch02-03-functions.html#functions-with-return-values | ||
[operators]: https://book.cairo-lang.org/appendix-02-operators-and-symbols.html |
55 changes: 55 additions & 0 deletions
55
exercises/practice/lucians-luscious-lasagna/.docs/instructions.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Instructions | ||
|
||
In this exercise you're going to write some code to help you cook a brilliant | ||
lasagna from your favorite cooking book. | ||
|
||
You have four tasks, all related to the time spent cooking the lasagna. | ||
|
||
## 1. Define the expected oven time in minutes | ||
|
||
Define the `expected_minutes_in_oven` binding to check how many minutes the | ||
lasagna should be in the oven. According to the cooking book, the expected | ||
oven time in minutes is 40: | ||
|
||
```rust | ||
expected_minutes_in_oven() | ||
// Returns: 40 | ||
``` | ||
|
||
## 2. Calculate the remaining oven time in minutes | ||
|
||
Define the `remaining_minutes_in_oven` function that takes the actual minutes | ||
the lasagna has been in the oven as a parameter and returns how many minutes | ||
the lasagna still has to remain in the oven, based on the expected oven time | ||
in minutes from the previous task. | ||
|
||
```rust | ||
remaining_minutes_in_oven(30) | ||
// Returns: 10 | ||
``` | ||
|
||
## 3. Calculate the preparation time in minutes | ||
|
||
Define the `preparation_time_in_minutes` function that takes the number of | ||
layers you added to the lasagna as a parameter and returns how many minutes you | ||
spent preparing the lasagna, assuming each layer takes you 2 minutes to | ||
prepare. | ||
|
||
```rust | ||
preparation_time_in_minutes(2) | ||
// Returns: 4 | ||
``` | ||
|
||
## 4. Calculate the elapsed time in minutes | ||
|
||
Define the `elapsed_time_in_minutes` function that takes two parameters: the | ||
first parameter is the number of layers you added to the lasagna, and the | ||
second parameter is the number of minutes the lasagna has been in the oven. | ||
The function should return how many minutes you've worked on cooking the | ||
lasagna, which is the sum of the preparation time in minutes, and the time in | ||
minutes the lasagna has spent in the oven at the moment. | ||
|
||
```rust | ||
elapsed_time_in_minutes(3, 20) | ||
// Returns: 26 | ||
``` |
Oops, something went wrong.