Python Forum
Error message in code - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Error message in code (/thread-5755.html)



Error message in code - Nistacta - Oct-19-2017

I need help with my code. the error message says:

Error:
Traceback (most recent call last) File "F:/Information format.py", line 17, in <module> output = string.format(name,age,city,free_time,work,reason) IndexError: tuple index out of range
reason = input ("Why do you want to work there?: ")

where = input ("Where do you want to work?: ")

name = input ("What Is Your Name?: ")

work = input ("Where Have You Worked Before?: ")

age = input ("How Old Are You?: ")

city = input ("What City Do You Live In?: ")

free_time = input ("What Do You Enjoy Doing On Your Free Time?: ")

string = "My name is {} and I am {} years old. I live in {} and I enjoy to {} in my free time. I have worked at {} before and I want to work at {} because {}"

output = string.format(name,age,city,free_time,work,reason)

print (output)



RE: Error message in code - metulburr - Oct-19-2017

You have 7 entries into the string, but only 6 in format()


RE: Error message in code - ichabod801 - Oct-20-2017

As metulburr says, you're missing a parameter to format. It looks like you are missing where you want to work.