Ape Mithrandir on Nostr: ```python import datetime as dt def greet_based_on_time(): now = ...
```python
import datetime as dt
def greet_based_on_time():
now = dt.datetime.now().time()
morning_threshold = dt.time(10, 0)
evening_threshold = dt.time(20, 0)
if now < morning_threshold:
print('GM')
elif now >= evening_threshold:
print('GN')
else:
raise Exception('Invalid time for greeting')
try:
greet_based_on_time()
except Exception as e:
print(e)
```
import datetime as dt
def greet_based_on_time():
now = dt.datetime.now().time()
morning_threshold = dt.time(10, 0)
evening_threshold = dt.time(20, 0)
if now < morning_threshold:
print('GM')
elif now >= evening_threshold:
print('GN')
else:
raise Exception('Invalid time for greeting')
try:
greet_based_on_time()
except Exception as e:
print(e)
```