Thu Jan 05 2023 01:07:50 GMT+0000 (UTC)

Saved by @Shaghaf_2000 #python

#Individual coding task 2 solution 
#get the current time and greet based on the time 

#get the time in the correct HH:MM format 
currenttime = input("Enter the current time in HH:MM 24 hour format: ")

#split the time into hours and minutes
splittime = currenttime.split(':')

#convert the minutes and hours to numbers 
splittime[0] = int(splittime[0])
splittime[1] = int(splittime[1])

#use the hours(the first part of splittime) to work out the greeting
if splittime[0]<12: #below 12 it is before noon
    print("Good Morning")
elif splittime[0]>=12 and splittime[0]<16: #above 12 and below 16
    print("Good Afternoon")
elif splittime[0]>=16 and splittime[0]<19: #above 16 and below 19
    print("Good Evening")
else: #must be before midnight 
    print("Good Night")