+ 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('')

30th Dec 2021, 11:53 PM
Mike
8 Respuestas
+ 2
Here's the "long" version: cardType = input().lower() if cardType == "visa" or cardType == "amex": print("accepted") edit: changed to "amex".
31st Dec 2021, 12:33 AM
rodwynnejones
rodwynnejones - avatar
+ 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
31st Dec 2021, 12:14 AM
rodwynnejones
rodwynnejones - avatar
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
31st Dec 2021, 12:24 AM
Mike
0
@C-MOON Sorry...I didn't realise is was a code coach thing.
31st Dec 2021, 12:39 AM
rodwynnejones
rodwynnejones - avatar
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.
31st Dec 2021, 1:00 AM
Mike
0
type = input() #your code goes here if type =="Visa" or type =="Amex": print("Accepted")
8th Jan 2023, 5:54 PM
Thon K. Giet
Thon K. Giet - avatar
0
putting the lower() after input() make a big meaning. Type = input().lower() if Type == "visa" or Type == "amex": print("accepted")
10th Jan 2023, 3:15 PM
Thon K. Giet
Thon K. Giet - avatar