0

After calling the functions it won't run the else statement, how can I fix this

def Tax(country, order_total): newline='\n' if country =='canada': province=input('What province in Canada : ').lower() if province =='alberta': print(f'''Alberta charge .05% General sales Tax (GST)''') tax=order_total*0.05 total_charge= order_total+tax print(f'''Tax ={tax}{newline}Total cost ={total_charge}''') elif province =='ontario' or 'new brunswick'or 'nova scotia': print(f'''13% Harmonized sales tax''') tax=order_total*0.13 total_charge= order_total+tax print(f'''Tax ={tax}{newline}Total cost ={total_charge}''') else: print(f'''.06% provincial sales tax + .05% GST tax''') tax=order_total*(0.06+ 0.05) total_charge=order_total+tax print(f'''Tax ={tax}{newline}Total cost ={total_charge}''') elif country !='canada': print(f'''Total cost ={order_total}'''

12th Jul 2020, 11:10 AM
Ajisegiri Sunday
Ajisegiri Sunday - avatar
2 Respuestas
+ 1
I havent run the code..but spotted this: elif province =='ontario' or 'new brunswick'or 'nova scotia': ..should be:- elif province =='ontario' or province == 'new brunswick' or province=='nova scotia': or use:- elif province in ['ontario', 'new brunswick', 'nova scotia']
12th Jul 2020, 11:18 AM
rodwynnejones
rodwynnejones - avatar
0
Ohh thanks I didn't really notice that
12th Jul 2020, 11:31 AM
Ajisegiri Sunday
Ajisegiri Sunday - avatar