Answer:
try:
cardNumber = str(input('Enter your card number her: \n'))
if (len(cardNumber) > 16 or len(cardNumber < 16)):
raise
except:
print ('You have entered an invalid cardNumber.')
else:
if cardNumber.startswith("2"):
print('American Express Card')
elif cardNumber.startswith("4"):
print('Visa Card')
elif cardNumber.startswith("5"):
print('Master Card')
else:
print('Unknown Card')
Explanation:
In the try block section:
The first line prompt the user for input, which is converted to string and assigned to cardNumber variable. The next line test the length of the cardNumber entered, if it is less than 16 or greater than 16; an exception is raise.
In the except section:
An error message is displayed telling the user that he/she has entered an invalid card number.
In the else section:
This is where is program check for type of card using an if...elif...else statement block. If the cardNumber start with 2; an output of "American Express card" is displayed. If the cardNumber start with 4; an output of "Visa card" is displayed. If the cardNumber start with 5; an output of "Master card" is display else "Unknown card" is displayed to the user.
Boolean can be use to check math as follows;
<h3>What are Booleans?</h3>
Booleans is a datatype with two possible values namely True and False.
The Boolean can be denoted as bool.
In programming its often use to check if a mathematical expression or statement are True or False.
Therefore, let's use it in mathematical expression;
6 < 5
8 > 7
6 == 9
The first expression will return False.
The second expression will return True.
The third expression will return False.
learn more on Booleans here: brainly.com/question/14120893
#SPJ11
MARK ME As BRAINLIEST
Answer is salvation