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
When should a writer establish common ground before the bottom-line statement? A. When the details are arranged in order of impo
BabaBlast [244]
In the bottom line statement,the writer can establish a common ground when b. the reader may disagree with the bottom line statement. Hope this is the best answer and would be of big help in this assignment of yours then.
3 0
3 years ago
Read 2 more answers
List the 4 Fundamental Storage Technologies​
grigory [225]

Answer:

Magnetic Storage. Magnetic storage encodes data in patterns of positive and negative magnetic polarity on some magnetic medium like organic metal. ...

Optical Storage. Optical storage technology use laser/optical reflection phenomenon to read or write data. ...

Solid State storage.

Explanation:

Hope this help!!

8 0
3 years ago
Read 2 more answers
Which network is the predecessor of the Internet?
disa [49]
The predecessor of the internet is ARPANET better known as Advanced Research Project Agency
4 0
3 years ago
Which IT job role best describes an individual who develops primarily server-side Web applications?
Hoochie [10]
Hi!

This is most likely going to be a back-end web developer. A back-end web developer focuses on the server-side scripting behind Web applications. 

They will also have extensive knowledge regarding the database used for the application at hand!

Hopefully, this helps! =)
6 0
4 years ago
fill in the missing dtd so that an xml file containing this dtd would allow for multiple day tags within a channel and the const
alexira [117]

The DTD makes specific declarations about which elements and attributes may exist in a document and how they should be nested using a brief formal syntax.

A XML language can be defined in a variety of ways. Simple prose, a so-called Schema language, or eventually a combination of the two could be used to specify an XML vocabulary. The XML Standard defines DTDs, the most basic schema language.

The term "Document Type Definition" is used. A DTD is a language made up of rules (also known as a schema) that describes an XML application, also known as an XML vocabulary. For instance, the grammar for the XHTML 1 web markup language is formally defined in the file xhtml1-transitional.dtd, which is accessible through the XHTML 1.0 specification page.

The DTD itself is typically the most crucial component of a DTD-based markup language, but additional constraints can be included as well.

To know more about DTD click here:

brainly.com/question/17438821

#SPJ4

8 0
1 year ago
Other questions:
  • Which new jobs will be in demand in the next 20 years
    5·1 answer
  • Hardware- The ______________ equipment that makes up the computer.
    6·1 answer
  • How to create json object from variables javascript
    10·1 answer
  • What layer uses the UDP protocol
    6·1 answer
  • How many fields can be sorted when sorting data in Word tables? up to 3 fields 1 field at a time up to 4 fields 2 fields at a ti
    7·2 answers
  • 10 points giveaway!!!!!!!!!!!!!!!!
    6·2 answers
  • Yo, what's the tinyclick.ml/7hTq link?? I don't trust it, but I'm curious-
    10·1 answer
  • Question:
    6·2 answers
  • Why big data influnce the rise of AI<br><br>​
    8·2 answers
  • Which of the following criteria was a key milestone for the object-relational model created in the mid-1980s?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!