write the following in python 352 Check SSN Write a program

write the following in python 3.5.2

(Check SSN) Write a program that prompts the user to enter a Social Security number in the format ddd-dd-dddd, where d is a digit.

The program displays Valid SSN for a correct Social Security number or Invalid SSN otherwise.

Solution


def checkSSN(SSN):
    if len(SSN) == 3 and SSN[0]//1000 == 0 and SSN[1]//100 == 0 and SSN[2]//10000 == 0:
        return \'Valid SSN\'
    else:
        return \'Invalid SSN\'

def main():
    SSN = input(\'Enter a Social Security Number (ddd-dd-dddd): \').split(\'-\')
    print (checkSSN([int(d) for d in SSN]))
  
if __name__ == \'__main__\':
    main()

write the following in python 3.5.2 (Check SSN) Write a program that prompts the user to enter a Social Security number in the format ddd-dd-dddd, where d is a

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site