Matt is a shop owner who sells pens and paper. He has been working hard and wants to go on vacation. He needs to earn 362 dollars to afford a plane ticket to Hawaii. He earns 2 dollars for each pen he sells.
Matt wrote a function to find out how many pens he must sell before he can purchase the plane ticket. However, in order to make his code correct, he must replace the word TURQUOISE with an integer.
Which integer should he replace the word TURQUOISE with?
1 2 3 4 5 6 7 8 |
|
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
In this function, m represents the current amount of money Matt has earned. The while loop is calculating how many pens Matt must sell. Every time Matt sells one more pen (pens = pens + 1), he also earns 2 more dollars (m = m + 2).
TURQUOISE should be replaced by 2 for the while loop to be correct.