Question

Write a program that asks the user for a zip code and converts it to a postal bar code. A postal bar code uses two types of lPython

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Find the code below.Follow the indentation as shown in screenshot.Cheers mate :d

encoding=['11000','00011','00101','00110','01001','01010','01100','10001','10010','10100']

def zipToEncodes(zipCode):
sum=0
s=""
for char in zipCode:
num=int(char)
sum+=num;
s=s+encoding[num]
s=s+encoding[sum%10]
return "1"+s+"1"
print("Please Enter your ZIP Code:",end='')
zipCode=input()
print(zipToEncodes(zipCode))
print("Please Enter your ZIP Code:",end='')
zipCode=input()
print(zipToEncodes(zipCode))

----------------------------------------------------------------

Zip.py - Eclipse IDE ce Search Project Pydev Run Window Help O !- - * - - - D Zip X i encoding=[11000, 20011, 00101,00

Add a comment
Know the answer?
Add Answer to:
Python Write a program that asks the user for a zip code and converts it to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Be sure to include the Karnaugh map used for each solution in the Word or PDF...

    Be sure to include the Karnaugh map used for each solution in the Word or PDF file you will submit in Review Quiz Part 2. For the following function: f(A,B,C,D,E) = m(16, 17, 21, 22, 24, 28) + d(0,4,8, 12, 18, 25, 27) (a) Complete the truth table. (16 points) ABCDE 00000 00001 00010 00011 00100 00101 00110 00111 01000 01001 01010 01011 01100 01101 01110 01111 10000 10001 10010 10011 10100 10101 10110 10111 11000 11001 11010 11011 11100...

  • Write C++ program T 1030 UUIII DUCOUL The bar code on an envelope used by the...

    Write C++ program T 1030 UUIII DUCOUL The bar code on an envelope used by the US Postal Service represents a five (or more) digit zip code using a format called POSTNET (this format is being deprecated in favor of a new system, OneCode, in 2009). The bar code consists of long and short bars as shown below: Illlllllllll For this program we will represent the bar code as a string of digits. The digit 1 represents a long bar...

  • 1 Until 2009, the US Postal Service printed a bar code on every envelope that represented...

    1 Until 2009, the US Postal Service printed a bar code on every envelope that represented the zip code using a format called POSTNET. We will be doing the same with only 5-digit zip codes. POSTNET consists of long and short lines, as seen below: The POSTNET representation of 67260, WSU's zip code In the program, the zipcode will be represented by an integer and the corresponding barcode will be represented by strings of digits. The digit 1 will represent...

  • In the program, the zipcode will be represented by an integer and the corresponding barcode will...

    In the program, the zipcode will be represented by an integer and the corresponding barcode will be represented by a string of digits. The digit 1 will represent the long bar, and the digit 0 will represent the short bar, The first and last digits of a POSTNET code are always 1. Stripping these leaves 25 digits, which can be split into groups of 5. The above example translates into the following string and groups of five: 101100100010010101100110001 01100 10001...

  • Write a python program that does the following. a. It asks the user to enter a...

    Write a python program that does the following. a. It asks the user to enter a 5-digit integer value, n. b. The program reads a value entered by the user. If the value is not in the right range, the program should terminate. c. The program calculates and stores the 5 individual digits of n. d. The program outputs a “bar code” made of 5 lines of stars that represent the digits of the number n. For example, the following...

  • Help me write a python code. Write a program that asks the user for the name...

    Help me write a python code. Write a program that asks the user for the name of a text file, then reads each line of the text file and prints it on the screen, making every other line "title case." For example, suppose the following text is saved in my_file.txt: While I nodded, nearly napping Suddenly there came a tapping As of someone gently rapping, Rapping at my chamber door. When run, the program looks like this: Enter filename: While...

  • How to write this code in C++???? using fstream Write a program which: Asks the user...

    How to write this code in C++???? using fstream Write a program which: Asks the user to enter a positive integer greater than 0 Validates that the entry is a positive integer Outputs the digits in reverse order with a space separating the digits Outputs the even digits not in reverse order with a space separating the digits (consider zero to be even) If there are no even digits, the an appropriate message should be displayed: There are no even...

  • In Python: Write a well-documented (commented) program that asks the user for a 9-digit integer, computes...

    In Python: Write a well-documented (commented) program that asks the user for a 9-digit integer, computes its checksum, and then prints the corresponding ISBN number. The International Standard Book Number (ISBN) is a 10-digit code that uniquely specifies a book. The rightmost digit is a checksum digit that can be uniquely determined from the other 9 digits, from the condition that d1 + 2d2 +3d3 + ... + 10d10 must be a multiple of 11 (here di denotes the ith...

  • In Python Write a well-documented (commented) program that asks the user for a 9-digit integer, computes...

    In Python Write a well-documented (commented) program that asks the user for a 9-digit integer, computes its checksum, and then prints the corresponding ISBN number. The International Standard Book Number (ISBN) is a 10-digit code that uniquely specifies a book. The rightmost digit is a checksum digit that can be uniquely determined from the other 9 digits, from the condition that d1 + 2d2 +3d3 + ... + 10d10 must be a multiple of 11 (here di denotes the ith...

  • Please write code using Python. Rubric Assignment Solution Total: 100 pts Program successfully retrieves and validates...

    Please write code using Python. Rubric Assignment Solution Total: 100 pts Program successfully retrieves and validates user input 15 pts Morse Code Function Created 10 pts Function Uses Parameters to get input message 15 pts Function successfully converts passed message to Morse Code and returns the Morse Code equivalent of message 45 pts Program calls Morse Code function and outputs the result of the function (i.e. the actual Morse Code) 15 pts Main Function Requirement Part 2 MUST have a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT