1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lakkis [162]
3 years ago
8

Write a Python function called validateCreditCard that takes 8-digit credit card number as the input parameter (string value) an

d display whether that number is valid or not. For example,
validateCreditCard("43589795") will display "Valid credit card number"
validateCreditCard("43589795") will display "Invalid credit card number"
Computers and Technology
1 answer:
babunello [35]3 years ago
6 0

Answer:

def validateCreditCard(x):

      if type(x)==str and len(x) == 8:

           print("Valid credit card number")

      else:

          print("Invalid credit card number")

validateCreditCard("43589795")

Explanation:

Run the code on your text editor(vs code, sublime, pycharm ) you will get your desired response. If your input is not of type string and not up to 8 digit you will get the response "invalid credit card number" but if it is of type string and up to 8 digit you will get "Valid credit card number".

But remember python works with indentation so when you are transferring this code to your text editor it will run properly well.

I defined the code using the conventional pattern "def"

After defining the function you create a brackets (x) to accommodate your argument x and end it with a semi colon.  

Then i use "if" statement to make sure only string argument and 8 digit value will be accepted to print a "valid credit card". if your argument does not pass the if statement condition it will print out the else statement condition which is "Invalid credit card number"

Finally, you have to call your function and test various values.

     

   

You might be interested in
A computer emergency response team is called at midnight to investigate a case in which a mail server was restarted. After an in
ANEK [815]

<u>Answer</u>:   B. Identify the source of the active connection

<em>Any problem can be fixed only finding of the source of it. We can fix a problem in ‘n’ number of ways but it might again come back if source of it is not identified.</em>

<u>Explanation:</u>

Identify the source of the active connection is the NEXT step the team should take. It is very similar to our human body.

If the infection is coming in the body again and again and gets fixed in the treatment, the reason for come - back will be identified so that it does not <em>lead to unnecessary treatment. </em>

In a similar way, if source are identified then the problem of come-back can be avoided. <em>So option B would be the right choice.</em>

4 0
3 years ago
In reference to computer communications, what does the term noise mean?
jeka94
Noise usually means static.
6 0
3 years ago
Read 2 more answers
Fuction table of JK-Flip flop?
vivado [14]

Answer:

Explanation:

The Truth Table for the JK Function. Then the JK flip-flop is basically an SR flip flop with feedback which enables only one of its two input terminals, either SET or RESET to be active at any one time thereby eliminating the invalid condition seen previously in the SR flip flop circuit.

6 0
3 years ago
Start
Crank

Answer:

N=5  key task decision start and end

Explanation:

8 0
3 years ago
It is ________ to pass an argument to a function that contains an individual array element, such as numbers[3].
Lapatulllka [165]

Answer:

The answer is "option B".

Explanation:

In the C++ programming language, it is legal to pass a parameter in the method that includes an individual array element. where an array is a collection of homogeneous (similar types of) elements. and other options are not correct that can be defined as:

  • In option, a Passing argument in a function is not illegal in c++.
  • In option c, It is recommended by the ANSI committee.
  • In option d, It is good for practice in coding.
5 0
3 years ago
Other questions:
  • Make sure to read all of these specifications carefully. Write a function, named array_shifter, that accepts an array of doubles
    12·1 answer
  • While driving you encounter an emergency vehicle stopped ahead. Discuss how the move over law applies to this situation and your
    13·1 answer
  • Consider what fact-finding techniques you would use to identify the important facts needed to develop a database system. Please
    7·1 answer
  • Janice, who is 15, posts post a picture of herself drinking alcohol and making an obscene gesture on her social network page. wh
    15·2 answers
  • Design a class that has an array of floating-point numbers. The constructor should accept an integer argument and dynamically al
    7·1 answer
  • Multiple Choice: We have been assigned the task of developing a software testing tool (tester) that can assess reachability of s
    11·1 answer
  • I will give brainliest to the best answer. what is a good screen recorder
    11·1 answer
  • Name various input and output devices used with computers.
    7·1 answer
  • What would a world where we have 2^128 (340 undecillion) Internet connected devices look like? How could that much Internet usag
    7·1 answer
  • There is overlap in the subjects of study in the different information technology disciplines. true or false
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!