Если вы введете время как: 10:24, это: datetime.datetime.strptime (время начала, "% H:% M") будет работать. Если вы введете время как 10, ваш пример будет работать.
Все зависит от того, как вы определяете ввод времени.
Кроме того, ваше сравнение не работает.
import datetime
distance_tobecovered = float(input("Please enter a number for the distance: "))
startime = input("Please input the time for the alarm in format HH:MM :")
fixed_charge = 3.5
perkilo_charge = 2.1 * distance_tobecovered
valueforall = fixed_charge + perkilo_charge
v = valueforall + (2 * distance_tobecovered * 0.99)
input_time = datetime.datetime.strptime(startime, "%H:%M")
if ((input_time.hour>=23) or (input_time.hour < 6)):
print("night or early morning")
print(v)#does some calculation
else:
print("day")
print("#does some calculation ")