+ 1
Sololearn course Financial Transaction cant get Mastercard to have a blank input
Using an ATM, customers can access their bank deposits or credit accounts to do a variety of financial transactions. You serve ATMs that accept only Visa and Amex bank cards. The given program takes the type of a bank card as input. Task Complete the program to output "accepted" if the card is Visa or Amex. Don't output anything otherwise. my code: type = input() #your code goes here card1='Visa' card2='Amex' card3='Mastercard' if card1=='Visa' and card2=='Amex': print('accepted') if card3=='Mastercard': print() iv also used type = input() #your code goes here if type: print('accepted') else: print('')
8 Antworten
+ 2
Here's the "long" version:
cardType = input().lower()
if cardType == "visa" or cardType == "amex":
print("accepted")
edit: changed to "amex".
+ 2
Do you need to use all those "if-statements, boolean-logic" etc in the tags to do it?
From what I can see, the task can be done in a one-liner
0
rodwynnejones I'm still learning and have been trying to Crack this but I keep getting task 1 and the other done but the Mastercard one is not going through with no input
0
@C-MOON
Sorry...I didn't realise is was a code coach thing.
0
C-MOON I did it rodwynnejones way prior to the code I gave now. Except I didn't put .lower I'll try it in a moment. it's the Mastercard part that isn't taking it because it reads
output: accepted
for all task.
0
type = input()
#your code goes here
if type =="Visa" or type =="Amex":
print("Accepted")
0
putting the lower() after input() make a big meaning.
Type = input().lower()
if Type == "visa" or Type == "amex":
print("accepted")