Can someone tell me what's wrong with this bit of code and what to change?
number = 1
text = "hello"
while number <= 10:
print("%d, %s" % number, text)
number = number + 1
Error:
Traceback (most recent call last): File "program.py", line 5, in print("%d, %s" % number + text) TypeError: not enough arguments for format string
It works when I do it this way:
number = 1
text = "hello"
while number <= 10:
print("%d" % number)
number = number + 1
I think i read somewhere that using the "%" sign to merge strings is the old way to do it, I'd like the code to still use it if it's possible.