0

Complete the program to output "accepted" if the card is Visa or Amex. Don't output anything otherwise.

"accepted" if type = Visa or Amex ( Test case that's wrong Mastercard should output nothing

4th Dec 2021, 1:44 AM
Amr Monsef
Amr Monsef - avatar
9 Antworten
+ 2
Even if type=='Amex' is False, 'Visa' will always be True What you wanted to do is if type == 'Amex' or type == 'Visa' Or better if type in ['Amex', 'Visa']
4th Dec 2021, 3:33 AM
Angelo
Angelo - avatar
+ 3
Amr Monsef Condition is little wrong. There should be if type == 'Amex' or type == 'Visa':
4th Dec 2021, 3:30 AM
A͢J
A͢J - avatar
+ 2
Amr Monsef Show your code? We have to print accepted in case of only Visa or Amex otherwise don't print anything.
4th Dec 2021, 3:24 AM
A͢J
A͢J - avatar
+ 2
Jay Matthews Lol sir there is unknown person who disliked our answer unnecessary even we are right. Can you please check and warn.
4th Dec 2021, 3:29 AM
A͢J
A͢J - avatar
+ 1
Amr Monsef This is just a simple comparison. Test cases are not wrong. You didn't understand this line so you think test cases are wrong. "Complete the program to output "accepted" if the card is Visa or Amex. Don't output anything otherwise." Read last statement again "Don't output anything otherwise".
4th Dec 2021, 2:55 AM
A͢J
A͢J - avatar
0
it's a task that i can't answer
4th Dec 2021, 1:48 AM
Amr Monsef
Amr Monsef - avatar
0
A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ test case that I GOT WRONG bro I don't know how to solve this and i need help, didn't say the app is wrong lol
4th Dec 2021, 3:18 AM
Amr Monsef
Amr Monsef - avatar
0
A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ type = input () if type == 'Amex' or 'Visa' : print ('accepted') that's all i got here .. but the case im missing is when the input is anything else for instance "Mastercard" it still gets "accepted"
4th Dec 2021, 3:28 AM
Amr Monsef
Amr Monsef - avatar
0
thanks Angelo
4th Dec 2021, 3:35 AM
Amr Monsef
Amr Monsef - avatar