Python Python Basics (2015) Logic in Python Print "hi"

Dolapo Sekoni
PRO
Dolapo Sekoni
Pro Student 1,431 Points

printer.py

please assist with this

printer.py
def printer(count):
    print("Hi" * {}.format(count))

printer(4)

1 Answer

Robert Ionut Muraru
PRO
Robert Ionut Muraru
Pro Student 3,519 Points

Hello. You don't need to add the .format part in your code, that works for strings and in this case Python thinks it has to do with a dictionary due to the {} which is outside the quotation marks. To fix it, multiply the string by the argument directly.