Misleading Wording
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.
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.
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
perhaps i was incorrect...
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.
Fixed in https://github.com/rust-lang/rustlings/commit/f5a4965de7174e122c5d99ec0a300285d0a0c658