1

noob programmer here. I'm having an issue with python not reading or ignoring what I wrote inside an if, it just goes straight to Exit Code 0. The first if works perfectly, but after the first else it jusr reads until color = input. I'd very much appreciate the help.

chooseS = input('If you need the scanning service type 1, if you need printing press 2. ')
pages = (int(input('How many pages do you need?')))
costT = 0
cost = 0
costS = 0
color = 0

if chooseS == str(1):
    costS = 20
    email = input("Type the email where you want to receive the scanned document.")
    costT = costS*pages
    print("That would be " + str(costT) + " colones. You will receive it at the following adress: " + email + ".")
else:
    if chooseS == str(2):
        color = input("If you need it printed in color type 1. If you need black and white type 2. ")
        if color == 1:
            paper = input("Regular paper: type 1. Film paper:  type 2. Sticker paper: type 3.")
            if paper == 1:
                cost = 25
                costT = int(pages) * cost
                print("That would be: " + str(+costT) + " colones.")
            if paper == 2:
                cost = 250
                costT = int(pages) * cost
                print("That would be: " + str(+costT) + " colones.")
            if paper == 3:
                costo = 300
                costoT = int(pages) * cost
                print("That would be: " + str(+costT) + " colones.")
        if color == 2:
            papel = input("Regular paper: type 1. Sticker paper: type 2. ")
            if paper == 1:
                cost = 15
                cost = int(pages) * cost
                print("That would be: " + str(+costT) + " colones.")
            if paper == 2:
                cost = 250
                costT = int(pages) * cost
                print ("That would be: " + str(+costT) + " colones.")

Any extra input on the code is also appreciated. Thanks in advance.

SAMG23
  • 57
  • 5

1 Answers1

1

color and paper and strings, you treat them as integers, the values will never match. Also when you type papel instead of paper. Here's how the code would look like after fixing these bugs:

chooseS = input('If you need the scanning service type 1, if you need printing press 2. ')
pages = (int(input('How many pages do you need?')))
costT = 0
cost = 0
costS = 0
color = 0

if chooseS == str(1):
    costS = 20
    email = input("Type the email where you want to receive the scanned document.")
    costT = costS*pages
    print("That would be " + str(costT) + " colones. You will receive it at the following adress: " + email + ".")
else:
    if chooseS == str(2):
        color = input("If you need it printed in color type 1. If you need black and white type 2. ")
        if color == str(1):
            paper = input("Regular paper: type 1. Film paper:  type 2. Sticker paper: type 3.")
            if paper == str(1):
                cost = 25
                costT = int(pages) * cost
                print("That would be: " + str(+costT) + " colones.")
            if paper == str(2):
                cost = 250
                costT = int(pages) * cost
                print("That would be: " + str(+costT) + " colones.")
            if paper == str(3):
                costo = 300
                costoT = int(pages) * cost
                print("That would be: " + str(+costT) + " colones.")
        if color == str(2):
            paper = input("Regular paper: type 1. Sticker paper: type 2. ")
            if paper == str(1):
                cost = 15
                cost = int(pages) * cost
                print("That would be: " + str(+costT) + " colones.")
            if paper == str(2):
                cost = 250
                costT = int(pages) * cost
                print ("That would be: " + str(+costT) + " colones.")

subspring
  • 690
  • 2
  • 7
  • 23
  • 1
    I'll try that! Thank you very much. And for papel it's because it's originally written in Spanish and I tried translating it. Thanks a lot again! – SAMG23 Mar 01 '22 at 07:47