Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

pls use simple way. i just learn it .cheers Checksum algorithms are used to determine whether a given number is valid or not. There are

pls use simple way. i just learn it .cheers

image text in transcribedimage text in transcribed

Checksum algorithms are used to determine whether a given number is valid or not. There are a variety of such algorithms. Implement a function called checksum() which accepts a single integer value and returns True if it is value and False otherwise. The algorithm for determining validity is as follows: 1. Reverse the number and double the value of every second digit, starting with the second digit. 2. If the result of the doubling operation results in more than one digit, then replace that value with the sum of the digits of the result. 3. Calculate the sum of all the digits. 4. Check if the sum of the digits is divisible by 7. If it is, then the number is valid, otherwise it is invalid. For example, if the number is: 123456789 First we reverse the number 9876543 2 1 Then we double the value of every second digit, starting with the second digit 9 16 7 12 5 8 3 4 1 Then we sum the digits of any number with more than 1 digit 9 77358 341 Then we sum all the digits together 47 Finally, we check if 47 is evenly divisible by 7 False In a second example, the number 95 would be checked as follows: 1. Reverse the number 59 2. Double every second digit, starting with the second digit 5 18 3. Sum the digits of any number10 5 9 4. Sum all the single digits together 14 5. Check if the number is divisible by 7 True A student who completes this exercise should be able to: . Index specific elements of a list Iterate through a list . Use arithmetic operators

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Fundamentals Concepts, Drivers & Techniques

Authors: Thomas Erl, Wajid Khattak, Paul Buhler

1st Edition

0134291204, 9780134291208

More Books

Students also viewed these Databases questions

Question

3 What are the four major aspects of an organisation culture?

Answered: 1 week ago