The barcode also includes a check digit. The final digit added to the bar code verifies the previous numbers are correct.To Determine the checksum:
The bar code also always starts and ends with a large bar. This is used by the scanner to align the letter. Drexel's Zip Code is 19104 The check digit is 5. The sum of the digits is 1+9+1+0+4 = 15. To make 15 a multiple of 10, we need to add 5. The bar code will be |:::|||:|:::::||||::::|::|:|:|:| The majority of work in this problem is done by digit. It makes sense to store the zip code as a string, not as an integer. Write the functionchecksum(zip) that takes the zip code as a string and returns the check digit as a string. Write a functionbarcode(zip) that takes a zip code as a string and returns the bar code. Develop a main program that repeatedly asks the user for zip codes and converts them to bar codes. The program will run until the user enters "exit". Remember to useif name=="main": so that ZyBooks can test your functions.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here