[ create a new paste ] login | about

Link: http://codepad.org/0wTWNcC0    [ raw code | output | fork ]

Python, pasted on May 16:
1
2
3
4
5
6
7
8
s = 'Alice'
i = 25

print('Alice is {} years old'.format(i))
# Alice is 25 years old

print('{} is {} years old'.format(s, i))
# Alice is 25 years old


Output:
1
2
3
4
Traceback (most recent call last):
  Line 4, in <module>
    print('Alice is {} years old'.format(i))
AttributeError: 'str' object has no attribute 'format'


Create a new paste based on this one


Comments: