0

I have no idea why the following does not work:

def getTotalPrice(DayType, TimeType, UnCalcTime, WkdayFullDayP, FullNightP, WkndPHr, WkdayPHr):
    if TimeType == 'Night':
        TotalPrice = 'Nuit'
        return TotalPrice
    elif DayType == 'Weekday' and TimeType == 'Full Day':
        TotalPrice = 'Exclusive'
        return TotalPrice
    elif DayType == 'Weekday' and TimeType == 'After School' or 'Before School':
        TotalPrice = 'determined'
        return TotalPrice
    elif DayType == 'Weekend':
        TotalPrice = 'Negligible'
        return TotalPrice




TimeType = 'Full Day'
DayType = 'Weekend'

TotalPrice = getTotalPrice(DayType, TimeType)
print(TotalPrice)

When printing 'TotalPrice' the result is determined. I have no idea as to why this is because surely it should be Negligible with the TimeType and DayType that I specified?

I really need this solving as its a small part of a much larger script and I cannot proceed until this error is sorted.

  • 2
    The `or` part is wrong. – Matthias Mar 24 '15 at 12:43
  • 'Before School' as a text converted to Boolean is evaluated as true and thus DayType == 'Weekday' and TimeType == 'After School' or 'Before School' translates into DayType == 'Weekday' and TimeType == 'After School' or Truewhich is always True no matter what TimeType or DateType is. – Dennis Sakva Mar 24 '15 at 12:49

0 Answers0