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
Maria's manager asked her to print a certain document for their meeting. It took her so long to find the file that she was late
Hoochie [10]

hey let me and sans help. . . . .hmmm. . .

sans said create a word-processing document that lists where she has saved files.

9 0
3 years ago
Read 2 more answers
The objectivity of a site relates to its a. Appearance c. Graphics b. Biases d. Quotes from other Internet authors
nadya68 [22]

The answer is Biases

The objectivity of evaluating a website relates to its ability to present issues based on different points of view. It is based on whether or not the information provided is presented in a fair and balanced way. For example, is the purpose of a certain website like Coca Cola or Pepsi meant to entertain, sell something, or sway public opinion? Do you think these websites will provide information on the negative effects of drinking carbonated beverages? I do not think so! Thus, these websites have bias. Their job is to sell you their product, not to make you think deep about it. We need to ask ourselves more questions about the websites we visit. Is this website balanced or biased in a way it presents information?


5 0
3 years ago
Read 2 more answers
Your friend wants to know about Microsoft Expression Web 4.
Vlad [161]
Microsoft Expression Web 4 is 
--
Component of Expression Studio
--
Design and Develop Web Pages using HTML5, CC3, ASP.Net, and more
--
Requires .Net Framework & Silverlight 4.0
--
3 0
3 years ago
•
Natali [406]

Answer:

ion k srry

Explanation:

3 0
3 years ago
In online advertising, the term "impression" refers to: the Web site displayed when a user clicks on an advertisement. the measu
Sunny_sXe [5.5K]

Answer:

Each time an ad is shown

Explanation:

The term view or add view can both be used to refer to impression in online advertising. It is basically a record of the number of times a web visitor sees an advertisment that is displayed on the webpage. To determine this number for a particular advertisement, the number of times the page containing the add is visited and loaded is counted as the advertisement is always going to be shown at each loading of the page.

4 0
3 years ago
Other questions:
  • Richman Investments is an investment and consulting firm. Richman wants to expand its business operations both in the U.S. and i
    14·1 answer
  • Alonzo collects bugs. He has created a fascinating display of large insects. Collecting bugs is a(n) _____ to Alonzo.
    10·2 answers
  • What is the main idea of this article? Please someone help me. I will give brainliest answer
    7·1 answer
  • Which windows command always navigates the command-line interface back to the root directory?
    8·1 answer
  • Write a program that reads a person's first and last names separated by a space, assuming the first and last names are both sing
    10·1 answer
  • Which of the following countries have mixed-market economy
    5·1 answer
  • What is an occupation?​
    6·1 answer
  • If a filesystem has a block size of 4096 bytes, this means that a file comprised of only one byte will still use 4096 bytes of s
    12·1 answer
  • Endnotes are indicated by
    6·2 answers
  • Explain why agile methods may not work well in organizations that have teams with a wide range of skills and abilities and well-
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!