Python Exercise 4 1. In the nine-digit Social Insurance Number (SIN) given to each person having a job or
filing an income tax return in Canada, the ninth digit is a checked digit that is used to test
the validity of the other digits in the SIN. The ninth digit is determined by the following
procedure.
a. Double the 2 nd , 4 th , 6 th , and 8 th digits, if it will become a 2 digit number, add all the
digits to make it a single digit. For example, 6x2 =12, then 1+2=3
b. Add the digits of the number found in step (a)
c. Add the 1 st , 3 rd , 5 th , and 7 th digits.
d. Add the number found in steps (b) and (c)
e. Subtract the units digit of the result of step (d) from 10 and note the units digit of the
result. For the SIN to be valid, its ninth digit must have this value.
Write a program that repeatedly reads nine-digit numbers and determines whether or not
each number is a valid SIN> The program should stop when it reads the value
999999999.

Solved
Show answers

Ask an AI advisor a question