Question: Spot the bug in the below code snippet # Function to collect user data def collectuser ( ) : f _ name = input (

Spot the bug in the below code snippet
# Function to collect user data
def collectuser():
f_name = input(\"Please enter your first name: \")
l_name = input(\"Please enter your last name: \")
age = int(input(\"Please enter your age: \"))
ssn = int(input(\"Please enter your Social Security Number without dashses: \"))
cc_num = int(input(\"Please enter your credit card number: \"))
if isinstance(f_name, str)!= True:
print(\"Please enter a valid string first name\")
exit()
if isinstance(l_name, str)!= True:
print(\"Please enter a valid string last name\")
exit()
if isinstance(age, int)!= True:
print(\"Please enter a valid integer age\")
exit()
if isinstance(ssn, int)!= True:
print(\"Please enter a valid SSN in the form of all integers\")
exit()
if isinstance(cc_num, int)!= True:
print(\"Please enter a valid credit card number in thr form of all integers\")
exit()
print(\"All input validated\")
print(f_name, l_name, age, ssn, cc_num)
# Call the function and use the data to print out a pwnd message to the user
user_info = collectuser()
print(\"Hello {}{}, you have been breached!! Thank you for supplying your age: {}, SSN: {}, and Credit Card information: {}.\".format(user_info[0],user_info[1],user_info[2], user_info[3], user_info[4]))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!