26th Feb 2025, 11:27 AM
Shri Hunde
Shri Hunde - avatar
5 Antworten
0
That's a good code bro Here's a improved version but that's generated by an AI : https://sololearn.com/compiler-playground/cc61qAjkMSjQ/?ref=app
27th Feb 2025, 4:17 PM
RORONOA ZORO
RORONOA ZORO - avatar
+ 4
Your code is mostly correct and works fine, but here are some improvements you can make. Add input validation, your code doesn't handle invalid inputs (like numbers outside 0–24 or non-numeric values). Add a check to ensure the input is valid using try and except. Handle edge cases, the current code assumes that 0 is evening, but you may want to handle 0 explicitly, especially for time formats. Also, simplify conditions for better readability by chaining comparisons with <= operator in python.
26th Feb 2025, 12:33 PM
✧GHOST✧
✧GHOST✧ - avatar
+ 3
Its s good code for beginners!! Remember this so that when you learn to import the time module ,you can improve it again!
27th Feb 2025, 6:18 PM
Daniel
Daniel - avatar
+ 1
if time >= 0 and time < 12 or time == 24: # Morning (1 to 11) print("Good Morning...") elif time >= 12 and time < 16: # Afternoon (12 to 15) print("Good Afternoon...") else: # Evening (16 and beyond) print("Good Evening...")
27th Feb 2025, 8:38 AM
Subhradeep Halder
Subhradeep Halder - avatar
+ 1
I am a total bigginer
28th Feb 2025, 7:06 AM
Viola Cheserem
Viola Cheserem - avatar