Invert wrote:
My simple python script gives me an error when I try to execute it.
Here is the error message:
dan...@ibex:~/Desktop/python$ python3 str_format2Daniel.py
Traceback (most recent call last):
File "str_format2Daniel.py", line 8, in <module>
print ("{0} is {1} years old {3} and ".format(name, age, append))
IndexError: tuple index out of range
dan...@ibex:~/Desktop/python$
Here is my script:
#!/usr/bin/python
# Filename: str_format2.py
age = 23
name = 'Daniel'
append = '6 months'
print ("{0} is {1} years old {3} and ".format(name, age, append))
That should be:
print ("{0} is {1} years old {2} and ".format(name, age, append))
print ('{0} will be an elite python programmer in {2}.'.format(name,
append))
What am I doing wrong?
--
http://mail.python.org/mailman/listinfo/python-list