Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Usability

Authors: Jakob Nielsen, Raluca Budiu

1st Edition

0133122131, 9780133122138

More Books

Students also viewed these Programming questions

Question

What activities do you enjoy when you are not working?

Answered: 1 week ago

Question

b. What is the cdf of depth?

Answered: 1 week ago