-1

I'm trying to make a yes or no question in which yes would equal the value(DEFAULT_OVERTIME_MULTIPLIER) and no would direct you to input any value want between 0 and 3; the yes portion works, but the no portion doesn't. What am I missing on this?

def get_multiplier():
    chosen_multiplier = -1

    while chosen_multiplier == input("Default multiplier is 1.5, Do you want that? (yes or no):"):
        if chosen_multiplier == "yes" or "Yes":
            chosen_multiplier = DEFAULT_OVERTIME_MULTIPLIER
        elif chosen_multiplier = "no" or "No":
            chosen_multiplier < MINIMUM_OVERTIME_MULTIPLIER or chosen_multiplier > MAXIMUM_OVERTIME_MULTIPLIER
            chosen_multiplier = float(input("Between 0 and 3, what is your overtime multiplier value? (Default is 1.5):" ))
        else:
            chosen_multiplier < MINIMUM_OVERTIME_MULTIPLIER or chosen_multiplier > MAXIMUM_OVERTIME_MULTIPLIER
            print("Invalid value, the overtime multiplier is between 0 and 3.")
    return chosen_multiplier
khelwood
  • 55,782
  • 14
  • 81
  • 108
  • 2
    See, for instance, [How to test multiple variables against a value?](https://stackoverflow.com/questions/15112125/how-to-test-multiple-variables-against-a-value) – khelwood Mar 01 '20 at 20:30

1 Answers1

0

You have single equality sign in line 7. Also you can't assign value in condition. What's more lines 8 and 11 don't do anything chosen_multiplier < MINIMUM_OVERTIME_MULTIPLIER or chosen_multiplier > MAXIMUM_OVERTIME_MULTIPLIER.

while True:
    choose = input("Default multiplier is 1.5, Do you want that? (yes or no):")
    if choose == "yes" or "Yes":
        chosen_multiplier = DEFAULT_OVERTIME_MULTIPLIER
    elif chosen_multiplier = "no" or "No":
        chosen_multiplier = float(input("Between 0 and 3, what is your overtime multiplier value? (Default is 1.5):" ))
    if chosen_multiplier < MINIMUM_OVERTIME_MULTIPLIER or chosen_multiplier > MAXIMUM_OVERTIME_MULTIPLIER:
        print("Invalid value, the overtime multiplier is between 0 and 3.")
    else:
        break

That may not do exactly what you want, but that's as much as I can understand and should give you some ideas.

miszcz2137
  • 894
  • 6
  • 18