Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading Wording #1778

Open
CirnoTo opened this issue Nov 18, 2023 · 4 comments
Open

Misleading Wording #1778

CirnoTo opened this issue Nov 18, 2023 · 4 comments

Comments

@CirnoTo
Copy link

CirnoTo commented Nov 18, 2023

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.

@matthri
Copy link
Contributor

matthri commented Nov 19, 2023

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.

@jsejcksn
Copy link

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:

#[test]
fn verify_test() {
let price1 = calculate_price_of_apples(35);
let price2 = calculate_price_of_apples(40);
let price3 = calculate_price_of_apples(41);
let price4 = calculate_price_of_apples(65);
assert_eq!(70, price1);
assert_eq!(80, price2);
assert_eq!(41, price3);
assert_eq!(65, price4);
}

@CirnoTo
Copy link
Author

CirnoTo commented Nov 22, 2023

perhaps i was incorrect...

@arthurkarganyan
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants