- 1
I was able to get the Amex and Visa but the problem is with the mastercard
Task Complete the program to output "accepted" if the card is Visa or Amex. Don't output anything otherwise. Sample Input Amex Sample Output accepted
13 Answers
+ 2
Read the task description carefully: The output is "Wrong number", not "Wrong Number"
0
SINKREAN VAEGAN GATES KLINĂMANN Include in the question description a link to your code in Code Playground and an explanation of your difficulties.
E ~ J Your code has two errors. Did it work in Code Playground?
0
Okh
0
But I still need your help
0
Its another coding question
0
Imagine a vending machine that sells fruits. Each fruit has its own number, starting from 0.
Write a program for the vending machine, which will take n number as input from the customer and return the fruit with that index.If n< 0 or n>7 (the index of last fruit ), the program outputs "Wrong number".
Sample Input:
2
Sample Output:
banana
0
fruits = ["apple", "cherry", "banana", "kiwi", "lemon", "pear", "peach", "avocado"]
num = int(input())
if num < 0 or num > 7:
print("Wrong Number")
else:
print(fruits[num])
0
Well the compiler has a different opinion
0
Test case 3
Input 12
Output Wrong Answer
Expected Output
Wrong Answer
Thats what the compiler is saying
0
Try this out it's an edit go the former code
fruits = ["apple", "cherry", "banana", "kiwi", "lemon", "pear", "peach", "avocado"]
com = ("you choose number")
print(fruits)
num = int(input())
if num < 0 or num > 7:
print("Wrong Number")
else:
print(fruits[num])
0
Card_type = input("Do you use an Amex or Visa card? ")
if Card_type == 'Visa' and 'Amex':
print('accepted')
else:
print("sorry your card is not in our database")
0
SINKREAN VAEGAN GATES KLINĂMANN If you need help, pls follow the question guidelines I mentioned before. This is vital for us to know what to help you on.
About the other question: pls open a new post. Always follow the golden rule: 1 post - 1 question.
0
Austin Gregory , your code has an error. Did it work in Code Playground?
Important: pls don't give finished code as answer, because it makes the OP skip the most important part of learning process. Always give hints for the OP to find the solution.