Python Forum

Full Version: Error message in code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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)
You have 7 entries into the string, but only 6 in format()
As metulburr says, you're missing a parameter to format. It looks like you are missing where you want to work.