Please write code in
Python!
You are asked to implement the following checksum formula to validate an identifi- cation number given to you. The formula works as follows. Using the original number, double the value of every other digit. Then add the values of the individual digits together (if a doubled value now has two digits, add the digits individually). The identification number is valid if the resulting sum is divisible by 10. Write a function called validateID that takes as input an identification number and returns 1 if the number is a valid checksum, 0 otherwise; it also returns the checksum that is calculated. The identification number is supplied to the function as a string.
Code :-
def validateID(idNumber):
numberList = [int(i) for i in idNumber]
#creating list of integers using list
comprehension
checkDigit = numberList.pop()
total = 0
flag = 0
for i in range(len(numberList)):
if (i%2==0):
total+=numberList[i]
else:
temp =
numberList[i]*2
if
(temp>9):
total+=1 #add the 1 from ten's
place
temp%=10 #obtain one's place
digit
total+=temp
#print(total) --used for
checking
total+=checkDigit #add the checkDigit
value
if (total%10==0): #if divisible by 10 then
valid
flag = 1
return total,flag
def main():
identificationNumber = "1762483"
total,flag = validateID(identificationNumber)
if (flag):
print("Valid data : Total is
",total)
else:
print("Invalid data : Total is
",total)
#checks if file was run as script or
imported
if __name__ == '__main__': main()
Output :-

Please write code in Python! You are asked to implement the following checksum formula to validate...
Write in java . I started it can you finish it. I will rate if
code works
What is this lab about and what will you be working on? In this lab, you will practice new tools and concepts you've learned in class and in lab. Namely this lab will be on methods, arrays (1D and 2D), and on repetition (using loops) In this lab, you will have to complete two activities. Here is what you have to do: Activity...
Write a program in Python that asks the user for the ISBN of the book in the format xxx-x-xxx-xxxxx-x. To validate: Initialize a total to 0 Have the program remove the dashes so that only the 13 digits are left in the ISBN string for each index of the first 12 digits in the 13 digit ISBN string get the digit at the current index as an integer If the current index is an even number, add the digit to...
Write a Python script named assignment2.py that implements the following steps given an integer value: 1.) Double the value of every second digit beginning from the right. For example, the number 1386 has digits [1, 3, 8, 6] which become [2, 3, 16, 6]. 2.) Add the digits of the doubled values and the digits that were not doubled from the original number. For example, [2, 3, 16, 6] becomes 2 + 3 + 1 + 6 + 6 =...
Please write the code in C++. This is all one question with multiple requirements. 1) Create an enumerated data type called CrdCard The types of Credit Cards to create are all 16 digits long except American Express: American Express (34 or 37), Visa (Starts with a 4), MasterCard (Starts with 51-55), Discover (Starts with 6011). 2) Create a function that takes in the enumerated type and returns a valid credit card number using the Luhn Algorithm (also called the Modulus...
Instructions Good news! You have are nearly finished with the semester! Today’s problem is going to be to modify a program to match the actual check used to verify Social Insurance Numbers. Don’t worry, the first part of the solution has been taken care of for you. You just need to modify it to also check the bits in BOLD font. A valid SIN is calculated by multiply odd-positioned digits (1st, 3rd, 5th, 7th, & 9th) by 1 and even-positioned...
Instructions In this problem, you will update the declaration for a function called validateSIN (), using the@paran and @re turn COmments and write the appropriate code for the function to check if a given SIN is valid or not You can test to see if a SIN is valid by using the following calculation. (WARNING: While this Is similiar to the ISBN validation calculation, It Is not the same. There are several differences] Remove hyphens so just digits remain ultiply...
Please answer in Visual Studio 2019 c# format. Not
python. Thank you.
Q. Write a program that works as described in the following scenario: The user enters a credit card number. The program displays whether the credit card number is valid or invalid. Here are two sample runs: Enter a credit card number as a long integer: 4388576018410707 4388576018410707 is valid Enter a credit card number as a long integer: 4388576018402626 4388576018402626 is invalid To check the validity of the...
PLEASE WRITE CODE FOR C++ ! Time Validation, Leap Year and Money Growth PartA: Validate Day and Time Write a program that reads a values for hour and minute from the input test file timeData.txt . The data read for valid hour and valid minute entries. Assume you are working with a 24 hour time format. Your program should use functions called validateHour and validateMinutes. Below is a sample of the format to use for your output file timeValidation.txt : ...
Validating Credit Card Numbers Write a program named Creditcard.java that prompts the user for a credit card number and determines whether it is valid or not. (Much of this assignment is taken from exercise 6.31 in the book) Credit card numbers follow certain patterns. A credit card number must have between 13 and 16 digits, and must start with: 4 for Visa cards 5 for Master cards 6 for Discover cards 37 for American Express cards The algorithm for determining...
Write a program in Python to solve the following task: In this project, you will build a phone number from digits entered by your user. Your program will loop until 10 valid digits have been entered. It will then use those digits to display the phone number entered using the format: XXXXXXXXXX (or (XXX) XXX – XXXX for extra credit). The program will ask for a digit, it will check to see if the digit is actually between 0 and...