Python Forum

Full Version: Help for a beginner - Index out of range ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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???
(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.
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
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