Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error message in code
#1
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)
Reply
#2
You have 7 entries into the string, but only 6 in format()
Recommended Tutorials:
Reply
#3
As metulburr says, you're missing a parameter to format. It looks like you are missing where you want to work.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Error message about iid from RandomizedSearchCV Visiting 2 1,038 Aug-17-2023, 07:53 PM
Last Post: Visiting
  Another Error message. the_jl_zone 2 992 Mar-06-2023, 10:23 PM
Last Post: the_jl_zone
  Mysql error message: Lost connection to MySQL server during query tomtom 6 16,141 Feb-09-2022, 09:55 AM
Last Post: ibreeden
  understanding error message krlosbatist 1 1,919 Oct-24-2021, 08:34 PM
Last Post: Gribouillis
  Error message pybits 1 42,340 May-29-2021, 10:26 AM
Last Post: snippsat
  f-string error message not understood Skaperen 4 3,362 Mar-16-2021, 07:59 PM
Last Post: Skaperen
  Overwhelmed with error message using pandas drop() EmmaRaponi 1 2,379 Feb-18-2021, 07:31 PM
Last Post: buran
  Winning/Losing Message Error in Text based Game kdr87 2 3,009 Dec-14-2020, 12:25 AM
Last Post: bowlofred
  poplib - parsing message body, could somebody please help explain this code t4keheart 2 2,307 Oct-12-2020, 01:59 PM
Last Post: t4keheart
  Don't understand error message Milfredo 2 2,064 Aug-24-2020, 05:00 PM
Last Post: Milfredo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020