How do I halt/stop a program when given a certain input in Python? [duplicate]

  python

i am making a program that calculates the cost of electricity with different rates during different periods of time.

How do i halt/stop the program if the user inserts "0" into the program?

print("Please enter the amount of kwh of electricity you have used during 7pm-7am") 

offPeak_cost =float (input())

if offPeak_cost:= 0.0:

Source: Python Questions

LEAVE A COMMENT