dimanche 24 octobre 2021

How can I use & in an if statement in python [closed]

Hi so i'm trying to do my assignment where I make a pay phone calculate how much money you are charged based off the day, time and duration off a call is, and I have to use an IF statement and so whenever I try to use an '&' in it, it gives me an error heres the code atm

code: (I just included why the error is caused i'll implement the day thing after I get a fix for this

day = str(input('Enter the day the call started at: '))
start_time = float(input('Enter the time the call started at (hhmm): '))
duration = float(input('Enter the duration of the call (in minutes):'))
cost = duration

if (start_time >= 08.00 & start_time <= 18.00):
    cost = duration * 0.40
else:
    print('haha loser')

print(cost)

and whenever I execute it and input my answers: Fri, 08.00, 22. It throws in this error

Error:

TypeError: unsupported operand type(s) for &: 'float' and 'float'

Aucun commentaire:

Enregistrer un commentaire