samedi 20 novembre 2021

Using if statements from inputs [closed]

I recently started learning to optimize some aspects of my job, and I am having trouble my 'if' statements to work (example below). I am trying to compare the input given for 'panel_type' to a name, and assign pricing based off of it, but I get "ParseError: bad input on line 8 (the first if statement)." I have messed around with how its written, but I can't tell what's wrong with the if statement.

import math

ridge_length = input("Ridge Length")
rake_length = input("Rake Length")
panel_length = rake_length
panel_type = input("Panel Type")

if panel_type == 'x'
        LF_price = 3.17
elif panel_type == 'y'
        LF_price = 3.14

panel_count = int(math.ceil(ridge_length/panel_width*2))
print(panel_count)
panel_cost = panel_count*panel_length*LF_price
print(panel_cost)

Aucun commentaire:

Enregistrer un commentaire