Question: 1. Please use python and show that test cases work , Thanks ! 3. Function One: cardType The first function you will write should be

1. Please use python and show that test cases work , Thanks !1. Please use python and show that test cases work , Thanks

3. Function One: cardType The first function you will write should be called cardType. Your function should take one (1) argument a string. The string should contain a credit card number. The function should return one (1) string containing one of the following five (5) values: Visa Your function should ensure that the string contains a valid card number. A valid card number contains ONLY numero digits (0-D) Additionally, a valid card number has exactly sicteen (18) digits. If the input argument is not a valid card number. your function should return Invalid Assuming the input argument contains a valid card number, the function should return visa if the first digit is a 4; return hasterCard' ifthe first digit is a 5; return "Discover cara. if the first digit is a 6; and return Unknown if the card number starts with anything other number. Page 2 of s CS 105-Intro to Computing Non-Tech Spring 2018 cardType 2845602912345, ) returns 4. Function Two: voteComp On the NASA Space Shutio, three computers wore in simultaneous use. Computations were performed by all hree computers. The result of each computation was put to a vote. If at least two of the computers provided the same result, that resut was used, If all three computers each provided a different result, then he computation was discarded. Your second function will implement the voting algorithm. The second function you will write should be called voteComp. Your function should take three (3) arguments: each one an integer The function should return one (1) value that will be either a number or string according to the following algorithm Each input integer will represent the output of one of the three computers. Iat least two of the arguments contain the same integer value, the function should return that value- lf all three values are different, the function should return the string ERROR roteComp (24. 45. 24) returns 34

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!