Printing string, variables together


#1


https://www.codecademy.com/courses/python-beginner-GB6hM/0/4?curriculum_id=4f89dab3d788890003000096

Traceback (most recent call last):
File "python", line 8, in
TypeError: not enough arguments for format string

I basically want to print what is happening on line 7 "meal = meal * tax + meal". So text mixed with the variables meal and tax. e.g Meal = 44.50 times tax 0.0675 equals total amount: Result


# Reassign meal on line 7!

meal = 44.50
tax = 0.0675
tip = 0.15

meal = meal * tax + meal
print  "Meal = %s. * %s" % meal % tax


#2

Hi @tadeusz666 for you to format the string correctly you would write,

print("Meal = %s. * %s" % (meal, tax))

and not,

the problem was that modulo operator between meal and tax :slight_smile:


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.