rustlings icon indicating copy to clipboard operation
rustlings copied to clipboard

Misleading Wording

Open CirnoTo opened this issue 2 years ago • 4 comments

Quiz one asks for a function that calculates the price of apples. It says if Mary buys MORE than 40 then they will one cost one rustbuck. HOWEVER the function requires that they cost 1 rustbuck for Greater than OR Equal to. This is misleading and I believe it should be changed.

CirnoTo avatar Nov 18 '23 01:11 CirnoTo

To my understanding the current code is correct. According to the tests the price for 40 apples is 80 rustbucks, which leads to 2 rustbucks per apple. If Mary buys more than 40 apples e.g. 41 the expected price is 41 rustbucks, which is 1 rustbuck per apple.

matthri avatar Nov 19 '23 01:11 matthri

To my understanding the current code is correct. According to the tests the price for 40 apples is 80 rustbucks, which leads to 2 rustbucks per apple. If Mary buys more than 40 apples e.g. 41 the expected price is 41 rustbucks, which is 1 rustbuck per apple.

Yes, here's the test function that's being referenced:

https://github.com/rust-lang/rustlings/blob/9a743f80c57cc6bf27819589a8ddb5a5579ab1a4/exercises/quiz1.rs#L22-L33

jsejcksn avatar Nov 22 '23 18:11 jsejcksn

perhaps i was incorrect...

CirnoTo avatar Nov 22 '23 23:11 CirnoTo

I had the same issue yesterday and had to look into tests after writing my incorrect solution. :)

Though, the issue isn't critical, I'd suggest to change the wording from

// Mary is buying apples. The price of an apple is calculated as follows:
// - An apple costs 2 rustbucks.
// - If Mary buys more than 40 apples, each apple only costs 1 rustbuck!

to

// Mary is buying apples. The price of an apple is calculated as follows:
// - An apple costs 2 rustbucks.
// - However, if Mary buys more than 40 apples, the cost for each apple in the entire order reduces to 1 rustbuck.

arthurkarganyan avatar Nov 26 '23 18:11 arthurkarganyan

Fixed in https://github.com/rust-lang/rustlings/commit/f5a4965de7174e122c5d99ec0a300285d0a0c658

mo8it avatar Jul 05 '24 13:07 mo8it