Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a function named inoutRoster that prompts a user for the name of a class r

ID: 3566827 • Letter: W

Question

Write a function named inoutRoster that prompts a user for the name of a class roster. The function has no parameters. This roster has names in the format IastName,firstName (no spaces). Your function should read this file, and create a new roster file with the format firstName lastName (one space between names, no comma). Your program MUST be written to prompt the user for the name of the roster file to be read. The new roster that your program creates MUST be output to a file named rosterFirstiosttxt (Note: there are no blanks in this file name).

Explanation / Answer

def InputRoster():
   print 'Enter The roster Filename to be read'
   f1 = raw_input()
   ofile = open(f1,'r')
   wfile = open("rosterFirstLast.txt",'w')
   for lines in ofile:
       s = lines.split(',')
       wfile.write(s[0]+' '+s[1]);
   wfile.close()

InputRoster()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote