Python Forum
Help for a beginner - Index out of range ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help for a beginner - Index out of range ?
#1
Hi all,

First time here .
And i am a beginner.
I do not know if this is the right place for a question.
I am trying to find why my program is out of index.
I have researched everything for hours and I am getting crazy.
I need help.
Can I post my code here???
Reply
#2
(Mar-02-2019, 08:18 AM)MarcM0901 Wrote: Can I post my code here???
Sure, post your code as well as the full traceback (error message) that you get. Please, use proper tags when post code, traceback, output, etc.
See BBcode help for more info.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
Here is my code:

def get_initials(fullname):
name_upper = fullname.upper()
split_name = name_upper.split(" ")
for new_name in range (len([split_name])):
print(split_name[0][new_name],end='')
return(split_name[1][new_name])


def main():
fullnameinput = input("What is your name? ")
#print(fullnameinput)
print(get_initials(fullnameinput))
if __name__ == "__main__":


'''The error is:

Index out of range
'''

And I can not understand why

Thank You
Reply
#4
You were explicitly advised to use BBCode tags.
Also you were asked to provide full traceback.
You did none of the above.
Please, use proper tags when post code, traceback, output, etc.
See BBcode help for more info.
Please, post the entire traceback that you get. We need to see the whole thing. Do not just give us the last line.
Take a time to read What to include in a post
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Thumbs Down I hate "List index out of range" Melen 20 3,161 May-14-2023, 06:43 AM
Last Post: deanhystad
Exclamation IndexError: Replacement index 2 out of range for positional args tuple - help? MrKnd94 2 5,967 Oct-14-2022, 09:57 PM
Last Post: MrKnd94
  IndexError: list index out of range dolac 4 1,844 Jul-25-2022, 03:42 PM
Last Post: deanhystad
  I'm getting a String index out of range error debian77 7 2,280 Jun-26-2022, 09:50 AM
Last Post: deanhystad
  IndexError: list index out of range Anldra12 2 1,409 May-03-2022, 01:39 PM
Last Post: Anldra12
  matplotlib x axis range goes over the set range Pedroski55 5 3,110 Nov-21-2021, 08:40 AM
Last Post: paul18fr
  IndexError: list index out of range rf_kartal 6 2,761 Sep-07-2021, 02:36 PM
Last Post: Larz60+
  Python Error List Index Out of Range abhi1vaishnav 3 2,239 Sep-03-2021, 08:40 PM
Last Post: abhi1vaishnav
  IndexError: list index out of range Laplace12 1 2,186 Jun-22-2021, 10:47 AM
Last Post: Yoriz
  IndexError: list index out of range brunolelli 11 6,349 Mar-25-2021, 11:36 PM
Last Post: brunolelli

Forum Jump:

User Panel Messages

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