On Thursday, July 16, 2015 at 9:16:01 PM UTC-5, craig...@gmail.com wrote: > I need help writing a homework program. > > I'll write it, but I can't figure out how to incorporate what I have read in > the book to work in code. > > The assignment wants us to take a users first, middle and last name in a > single input ( name=('enter your full name: )). > > Then we must display the full name rearranged in Last, First Middle order. > > I tried to use the search function in Python to locate any spaces in the > input. It spot back the index 5 (I used Craig Daniel Sirna) > > That is correct for the first space, but I can't figure out how to get it to > continue to the next space. > > The indexing process is also a bit confusingto me. > > I get that I can use len(fullName) to set the length of the index, and how > the index is counted, but after that I'm lost. > > I have emailed my professor a few times, but haven't gotten a > response.(online course) > > Any help would be greatly appreciated.
def main(): name= input('Enter your full name: ') split=name.split() Full_name=split[2],split[0], split[1] print(Full_name[2],',', Full_name[0], Full_name[1]) main() Sorry it took so long to get back to you guys and I greatly appreciate all the help!!! But I just did it now and it does work. I have been working on my College algebra homework for the past week and I am still not even finished or ready for the test....fml.... -- https://mail.python.org/mailman/listinfo/python-list