Exercise-1

Add the specified code for each code cell, running the cells in order.

Create a variable food that stores your favorite kind of food. Print or output the variable.


In [ ]:

Create a variable restaurant that stores your favorite place to eat that kind of food.


In [ ]:

Print the message "I'm going to RESTAURANT for some FOOD", replacing the restaurant and food with your variables.


In [ ]:

Create a variable num_friends equal to the number of friends you would like to eat with.


In [ ]:

Print a message "I'm going with X friends", replacing the X with the number of friends.


In [ ]:

Create a variable meal_price, which is how expensive you think one meal at the restaurant would be. This price should be a float.


In [ ]:

Update (re-assign) the meal_price variable so it includes a 15% tip—that is, so the price is 15% higher. Output the variable.


In [ ]:

Create a variable total_cost that has the total estimated cost of the bill for you and all of your friends. Output or print the variable


In [ ]:

Create a variable budget representing your spending budget for a night out.


In [ ]:

Create a variable max_friends, which is the maximum number of friends you can invite, at the estimated meal price, while staying within your budget. Output or print this value.

  • Be carefully that you only invite whole people!

In [ ]:

Bonus: Create a variable chorus that is the string "FOOD time!" repeated once for each of the friends you are able to bring. Hint use the * operator. Print out the variable.


In [ ]:

Modify the above cell so that each "FOOD time!" is on a separate line (hint: use a newline character!), then rerun the cell.