Opening your workspace…
Workspace/Coding room
Opening your workspace…
You’re at Pierre’s shop in Stardew Valley, counting how many parsnips you need to sell to afford the first backpack. Each parsnip sells for a given number of gold, and the backpack costs 2,000g. Return the fewest whole parsnips you must sell to cover the cost.
35Output5857 parsnips earn 1,995g, so you need 58 to reach 2,030g.
50Output4040 parsnips earn exactly 2,000g.
Round up after dividing the backpack price by the sale price.
function solve(parsnipPrice) { // Write your solution here. }
Tab inserts two spaces. Shift+Tab outdents. Use the arrow keys and Tab to choose a suggestion. Press Escape, then Tab, to leave the editor. Press Control or Command with apostrophe to run samples or with Enter to submit.