Formatting the Python string using .format and variable

s1 = "cats"

print "are 10 cats {}" .format(s1*10)
print "are 10 cats {10cats}" .format(10cats=s1*10)

First print works, second I get SyntaxError: invalid syntax. Why?

Variable names in python (and many other languages) cannot start with numbers. If you used a legal variable name, the second would work fine.

>>> s1 = "cats"
>>> print("are 10 cats {cats}" .format(cats=s1*10))
are 10 cats catscatscatscatscatscatscatscatscatscats