Bottom Page

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???
Quote
#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.
Quote
#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
Quote
#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
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Get all values of for loop with an index BollerwagenIng 2 143 Aug-09-2019, 07:58 AM
Last Post: BollerwagenIng
  Setting maximum value of Range() in For loop pmt 4 205 Aug-04-2019, 02:38 PM
Last Post: pmt
  IndexError: string index out of range ? Q_Y 5 352 Jul-05-2019, 07:18 PM
Last Post: noisefloor
  index out of range rwahdan 3 247 Jul-04-2019, 08:11 PM
Last Post: ichabod801
  is there a reverse index? Skaperen 6 305 Jun-14-2019, 11:47 PM
Last Post: Skaperen
  List of dictionaries: use key-value instead of index? dn237 6 382 Jun-03-2019, 05:52 PM
Last Post: Yoriz
  Preventing: IndexError: list index out of range PappaBear 1 392 Jun-03-2019, 05:50 PM
Last Post: SheeppOSU
  getting index ThinleyJimmyDorji 2 189 May-24-2019, 05:11 PM
Last Post: buran
  json.load causing IndexError: list index out of range WallyZ 5 340 May-20-2019, 01:11 PM
Last Post: WallyZ
  Selecting a sample based on index Scott 1 212 May-14-2019, 08:44 AM
Last Post: Serferi

Forum Jump:


Users browsing this thread: 1 Guest(s)