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
An example of software is a _____.<br><br> spreadsheet<br> mouse<br> track ball<br> printer
algol13

An example of software is a spreadsheet :)

8 0
2 years ago
A recipe for deducing the square root involves guessing a starting value for y. Without another recipe to be told how to pick a
Gnoma [55]

Answer:

TRUE

Explanation:

TRUE - A recipe for deducing the square root involves guessing a starting value for y. Without another recipe to be told how to pick a starting number, the computer cannot generate one on its own.

5 0
3 years ago
A network technician is setting up a wireless access point in the front office of a small company. The technician needs to disab
VladimirAG [237]

Answer:

He should disable UPnP technology to disallow devices to dynamically add themselves to the network without configuration.

Explanation:

  • UPnP stands for Universal Plug n Play.
  • It is an easiest way that allows gadgets to find all other devices connecting to your network.
  • This can also modify router settings to allow devices from outside the network to access the router.
  • External IP address can also be obtained by the gadget and a new port forwarding map can be set
  • So from all perspectives, UPnP is an open invitation for hackers to scan for the ports and hack into the device.
  • UPnP is a vulnerability to the secure system
6 0
3 years ago
Get the user to enter some text and print it out in reverse order.
svetlana [45]

Answer:

strrev in c/c++

Explanation:

3 0
2 years ago
State 4 &amp; circumstances under which warm<br>booting of a computer may be necessary​
Brums [2.3K]

Answer:

to close an open application

3 0
3 years ago
Other questions:
  • Write a program that accepts 5 number and arrange them in ascending order​
    7·1 answer
  • The main purpose of a constructor is to initialize the data members at the moment that an object is created. true or false?
    8·1 answer
  • Through the use of a _____ system, information on prospective, current, and past customers is stored and analyzed for future pla
    15·1 answer
  • If you have two tasks x and y, with y being a successor to x, if we mark x as undone (because it needs to be redone for some rea
    15·1 answer
  • Please help! Game design!
    7·1 answer
  • When entering information for a new contact in the address book, Outlook will automatically create a _____. A. Invitation B. Res
    7·1 answer
  • The Yuba College Library would like a program to calculate patron fines for overdue books. Fines are determined as follows: Pape
    15·1 answer
  • By what decade were books readily available to the public across the United States and Europe?
    7·1 answer
  • Michelle has defined a custom object by creating an object literal. She wants to access the properties of the custom object. Mic
    10·1 answer
  • Identify the true statements about the approach to privacy around the world. a. Uncertainty concerning the nature, extent, and v
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!