Please serius programmer only Program 1 20 pts Using python

Please serius programmer only

Program 1 – 20 pts Using python 2.7.

Step 1 (10 pts) – isValidSSN function

PreCondition: one parameter – any string
Description: returns True if the string is in the form ###-##-####
                       returns False otherwise.

NOTE: do NOT have ANY print statements in this function!

Step 2 (10 pts) - List of SubLists

Continue asking the user to enter SSNs until they type DONE.
Use your function to check to ensure the entry is a valid social security number.
If the social security number was valid, ask the user to enter the following information:

Last name

First name

Birth year

Store the information in a list called myEmps that contains sublists with the employee name (last name followed by a comma followed by the first name), age, and social security number. Example of how the myEmployees list will look:
[ [ “Johnson,Joe”, 1970, “501-11-1111” ],
    [“Miller,Mary”, 1998, “503-33-3333” ]
]
                   
When the user types DONE, print headings followed by the entries in the myEmployees list, one per line.

Use the FORMAT METHOD to ensure that columns are aligned. Do NOT use \\t to align!
Note: all social security numbers should be printed in the form ###-##-####

Example Output:

Name                                                    Birth Year                                            SSN

Joe Johnson                                       1970                                                     501-11-1111
Mary Miller                                         1998                                                      503-33-3333

Solution

def isValidSSN(arg):
   arg = arg
   parametes = arg.split(\'-\')
   if len(parametes) != 3:
       return False
   elif len(parametes[0]) != 3:
       return False
   elif len(parametes[1]) != 2:
       return False
   elif len (parametes[2]) != 4:
       return False
   else:
       return True

def main():
   myEmps = []
   while True:
       arg = raw_input(\'Enter the SSN: \')
       if arg == \'Done\':
           print(\'{:<17} {:^17} {:>14}\'.format(\'Name\', \'Birth Year\', \'SSN\'))
           for i in myEmps:
               name = i[0]
               name = name.split(\',\')
               name = name[1]+\',\'+name[0]
               print(\'{:<17} {:^17} {:>17}\'.format(name, i[1], i[2]))
           return

       valid = isValidSSN(arg)
       if valid == True:
           lname = raw_input(\'Enter Last Name: \')
           fname = raw_input(\'Enter First Name: \')
           byear = raw_input(\'Enter Birth year: \')
           name = lname+\',\'+fname
           empInfo = [name, byear, arg]
           myEmps.append(empInfo)


          
if __name__ == \'__main__\':
   # arg = \'454-34-2344\'
   # print isValidSSN(arg)
   main()

Please serius programmer only Program 1 – 20 pts Using python 2.7. Step 1 (10 pts) – isValidSSN function PreCondition: one parameter – any string Description: r
Please serius programmer only Program 1 – 20 pts Using python 2.7. Step 1 (10 pts) – isValidSSN function PreCondition: one parameter – any string Description: r

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site