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 group of Automation Anywhere Enterprise users are required to automate bots for a customer change requirement. The users find
stich3 [128]

There are a number of tools that have emerged since Automation was born. One such tool is the Automation Anywhere. It is a good example of an RPA tool that is used to automate various tasks and upload task bots. Automation Anywhere is made up of three main components. These components include Bot Creators, Bot Runners, and Control Room.

Further explanation

To answer the question, it is most likely that these users have a Community edition which does not allow them to upload bots to the control room. It is also most likely that the users are running a developer license and not a runner (Enterprise) license. Whether or not this is the case, the administrator needs to assign them an administrator role and not a developer one which I assume they are using

Community edition helps users interact with the most basic features of the tool before they are comfortable enough to upgrade to the Enterprise version. These users are able to automate bots for customers only if they have the Administrator role option. The Administration option is found on the Enterprise edition only and not the community edition.

Learn more about

brainly.com/question/11317405

brainly.com/question/11317405

#LearnWithBrainly

6 0
3 years ago
Which of the following changes would be LEAST LIKELY lead to economic growth in a country?
Charra [1.4K]

Answer:

A. declines in labor productivity

Explanation:

6 0
3 years ago
Steps of booting a computer
Lostsunrise [7]
Steps of Booting
The Startup. It is the first step that involves switching the power ON. ...
BIOS: Power On Self Test. It is an initial test performed by the BIOS. ...
Loading of OS. In this step, the operating system is loaded into the main memory. ...
System Configuration. ...
Loading System Utilities. ...
User Authentication.
8 0
2 years ago
output device. Vrite very short answer of the following questions. What is computer hardware? Which dovico in lini nwhich device
kirill115 [55]

Computer hardware is the physical components that a computer system requires to function.

Have a gr8 day ahead ✌️

7 0
2 years ago
1.Write a Java program to solve the following problem using modularity. Write a method that rotates a one-dimensional array with
Westkost [7]

Answer:

Explanation:

The following code is written in Java and it asks the user for the size of the array. Then it randomly populates the array and prints it. Next, it rotates all the elements to the right by 1 and prints the new rotated array.

import java.util.ArrayList;

import java.util.Arrays;

import java.util.Random;

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       Random r = new Random();

       Scanner in = new Scanner(System.in);

       System.out.println("Enter Size of the Array: ");

       int arraySize = in.nextInt();

       ArrayList<Integer> myList = new ArrayList<>();

       for (int x = 0; x < arraySize; x++) {

           myList.add(r.nextInt(15));

       }

       System.out.println("List Before Rotation : " + Arrays.toString(myList.toArray()));

       for (int i = 0; i < 1; i++) {

           int temp = myList.get(myList.size()-1);

           for (int j = myList.size()-1; j > 0; j--) {

               myList.set(j, myList.get(j - 1));

           }

           myList.set(0, temp);

       }

       System.out.println("List After Rotation :  " + Arrays.toString(myList.toArray()));

   }

}

6 0
3 years ago
Other questions:
  • What does using indirect quotations allow a writer to do?
    7·2 answers
  • What are the types of hypervisiors ?
    5·2 answers
  • Pseudocode is an improvement over the IPO chart because it lays out the a0 sequence of steps for a particular program.
    6·1 answer
  • What is transaction model?
    9·2 answers
  • To maintain her audience's confidence in her, what should kiara not do while delivering her presentation?
    10·1 answer
  • Create a function names minElement() that takes an array of numbers as a paaramter and returns the min value of the array. The a
    9·1 answer
  • Presentation graphics programs contain an assortment of tools and operations for creating and editing slides, including preforma
    8·2 answers
  • MP3 BrainPoP Quiz
    13·2 answers
  • HOW TO DISCONNECT A MONITOR FROM A SYSTEM UNIT
    6·1 answer
  • What is this line called that appears and disappears in the search box<br><br> WILL MARK BRAINLIEST
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!