Question

Write a program that takes the plastic identification number from the user and returns information. The program should allowPlease help me with this Python program.

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

Answer is after the screenshot of the output

PLEASE REFER SCREENSHOT OF THE CODE TO PROPERLY COPY PASTE THE CODE, OTHERWISE YOU MIGHT GET INDENTATION ERRORS

CODE:

OUTPUT:

ANSWER:

#function which prints welcome message

def printWelcome():

    print("Welcome to the plastic identification program!")

    print("Enter plastic identification number and get it's information")

#takes input and returns it

def validateUserInput1to7():

    n=int(input("Enter the plastic identification number: "))

    #if the number is invaid call the function again(recursive calls until the input is valid)

    if n<1 or n>7:

        print("Inlavid input")

        return validateUserInput1to7()

    return n

#main function

printWelcome()

#infinite loop

while True:

    #get the value of n

    n=validateUserInput1to7()

    #if else block to print output

    if n==1:

        print("PET is intended for single use. Reusing increases the risk of carcinogen leaching and bacterial growth. PET is difficult to decontaminate.Recycle but don't reuse.")

    elif n==2:

        print("HDPE is one of the safest forms of plastic. Resistant to heat and cold. Can be reused and recycled")

    elif n==3:

        print("PVC is relatively impervious  to sunlight and weather. It contains numerous toxins that can leach throughput the lifecycle of the plastic. Cannot be recycled.Can be reused.")

    elif n==4:

        print("LDPE is relatively safe for use. Reusable but not always recyclable")

    elif n==5:

        print("PP is heat-resistant and acts as barrier against moisture, grease and chemicals. Can be reused and recycled")

    elif n==6:

        print("PS is inexpensive and lightweight. Leaches carcinogens and breaks up easily. Low market for recycling and difficult to reuse. Should be avoided.")

    elif n==7:

        print('PC and "other" plastics. These vary which is confusing for the customers. Becase of concerns with carcinogen leaching, avoid these unless it also contains the letters PLA or Compostable. These are made from bio-based polymers that can be composted.')

    #ask the user to enter choice, if input is 1 then break out of the loop

    ch=int(input("Enter choice, 1 to continue, 0 to Quit: "))

    if ch==0:

        break

Add a comment
Know the answer?
Add Answer to:
Please help me with this Python program. Write a program that takes the plastic identification number...
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
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