Session Ready
Exercise

Let's order pizza!

As a final exercise in using paste() and to celebrate getting to the end of the first chapter, let's order some pizza.

We've got a list of possible pizza toppings in toppings.

You are going to randomly select three toppings, and then put them together using paste() into an order for pizza, that should result in a string like,

"I want to order a pizza with mushrooms, spinach, and pineapple."
Instructions
100 XP
  • Print my_toppings to see your random toppings.
  • Add "and " to the start of the third element by using paste() with my_toppings and a vector you define.
  • Create a vector these_toppings by using paste() to collapse my_toppings_and with a comma and space between each element.
  • Create my_order by pasting "I want to order a pizza with " to these_toppings and ending with a period, ".".
  • Order your pizza by calling writeLines() on my_order.
  • Try re-running all your code (including the sampling of toppings). You should get a brand new pizza order!