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
To remove white space, double-click this icon.
sweet [91]
Follow these steps:<span>Click the Microsoft Office Button, and then click Word Options.
In the left pane, click Customize.In the Choose commands from list, click All Commands.<span>
Click White Space Between Pages, click Add, and then click OK.
The White Space Between Pages option will appear on the Quick Access Toolbar.</span></span>(google)
I hope I answered your question!
4 0
3 years ago
Give two examples of html structure
butalik [34]

Answer:

semantic information that tells a browser how to display a page and mark up the content within a document

7 0
3 years ago
A company's loss control department identifies theft as a recurring loss type over the past year. Based on the department's repo
maria [59]

Answer: C) Motion detectors

Explanation:

Motion detectors is the device that is used for detection of moving object in any area. They are used for security purposes by tracking motion or people and alerting the user.It consist of motion sensor for detection of motion and alerting the users or organization about security breach through alarming .

  • According to the question,Chief information officer should implement motion detectors to investigate about theft that takes place in company's department on regular basis.Any intervention for company's loss will be alerted through tracking motion of the thief.
  • Other options are incorrect because camera is used for recording videos and images. Bio-metric device is used for digital identification of any person to enter into a system. Man-trap is vestibule used for controlling access of a person for security.
  • Thus, the correct option is option(C).
6 0
3 years ago
Photographing during the midday can produce which of the following?
bija089 [108]

Answer:

great lighting

great emotion

great setting

great feeling

5 0
3 years ago
If the audio has no sound:
Mice21 [21]

Answer:

B

Explanation:

the file to be transcribes should have an audio,it maybe a scam,so you have to file a report.

6 0
3 years ago
Other questions:
  • A customer has contacted you to help him alleviate the large amount of time and effort that goes into adding and removing users
    12·1 answer
  • g What differences do you anticipate there being between working inside vs outside City government in data and digital services?
    8·1 answer
  • Which cisco ios command is used to display the current ospf neighbors and their rids?
    11·1 answer
  • Graphs and charts are two different elements. True or False
    15·1 answer
  • 2(x-5)-3(3-x)=1/2(x-2)
    9·1 answer
  • Beside homework, what products can you use for personal use? Identify three uses and briefly describe.
    13·2 answers
  • A device is sending out data at the rate of 1000 bps. How long does it take to send
    12·1 answer
  • What method of thermal energy is at work when heat lamps are used to warm up baby chickens?
    11·2 answers
  • Write a program that uses a structure to store the following data about a customer account: Name Address City, State, and ZIP Te
    10·1 answer
  • Say true or false
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!