mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-21 21:42:23 -05:00
Improve quizes
This commit is contained in:
parent
f5a4965de7
commit
65834fc420
4 changed files with 4 additions and 17 deletions
|
@ -7,11 +7,10 @@
|
||||||
// - An apple costs 2 rustbucks.
|
// - An apple costs 2 rustbucks.
|
||||||
// - However, if Mary buys more than 40 apples, the price of each apple in the
|
// - However, if Mary buys more than 40 apples, the price of each apple in the
|
||||||
// entire order is reduced to only 1 rustbuck!
|
// entire order is reduced to only 1 rustbuck!
|
||||||
|
|
||||||
// TODO: Write a function that calculates the price of an order of apples given
|
// TODO: Write a function that calculates the price of an order of apples given
|
||||||
// the quantity bought.
|
// the quantity bought.
|
||||||
|
// fn calculate_price_of_apples(???) -> ??? { ??? }
|
||||||
// Put your function here!
|
|
||||||
// fn calculate_price_of_apples(???) -> ??? {
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// You can optionally experiment here.
|
// You can optionally experiment here.
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
// Mary is buying apples. The price of an apple is calculated as follows:
|
// Mary is buying apples. The price of an apple is calculated as follows:
|
||||||
// - An apple costs 2 rustbucks.
|
// - An apple costs 2 rustbucks.
|
||||||
// - If Mary buys more than 40 apples, each apple only costs 1 rustbuck!
|
// - However, if Mary buys more than 40 apples, the price of each apple in the
|
||||||
// Write a function that calculates the price of an order of apples given the
|
// entire order is reduced to only 1 rustbuck!
|
||||||
// quantity bought.
|
|
||||||
|
|
||||||
fn calculate_price_of_apples(n_apples: u64) -> u64 {
|
fn calculate_price_of_apples(n_apples: u64) -> u64 {
|
||||||
if n_apples > 40 {
|
if n_apples > 40 {
|
||||||
|
|
|
@ -1,10 +1,3 @@
|
||||||
// This is a quiz for the following sections:
|
|
||||||
// - Strings
|
|
||||||
// - Vecs
|
|
||||||
// - Move semantics
|
|
||||||
// - Modules
|
|
||||||
// - Enums
|
|
||||||
//
|
|
||||||
// Let's build a little machine in the form of a function. As input, we're going
|
// Let's build a little machine in the form of a function. As input, we're going
|
||||||
// to give a list of strings and commands. These commands determine what action
|
// to give a list of strings and commands. These commands determine what action
|
||||||
// is going to be applied to the string. It can either be:
|
// is going to be applied to the string. It can either be:
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
// This quiz tests:
|
|
||||||
// - Generics
|
|
||||||
// - Traits
|
|
||||||
//
|
|
||||||
// An imaginary magical school has a new report card generation system written
|
// An imaginary magical school has a new report card generation system written
|
||||||
// in Rust! Currently, the system only supports creating report cards where the
|
// in Rust! Currently, the system only supports creating report cards where the
|
||||||
// student's grade is represented numerically (e.g. 1.0 -> 5.5). However, the
|
// student's grade is represented numerically (e.g. 1.0 -> 5.5). However, the
|
||||||
|
|
Loading…
Reference in a new issue