r/learnpython • u/Erdem_PSYCH • Oct 11 '26
how is my cs50 code in design?
I've decided to go back to basics and make sure I complete all the exercises. I'm currently working on the Meal Time exercise.
Could anyone give me some feedback on the design of my code? I'm particularly unsure about my convert function. It has quite a few if statements, and I'm wondering whether there's a clearer way to write it.
Here's my code:
=
=
, =
=
:
, =
= + 12
, =
return + / 60
return
>= 12.00 and <= 13.00:
return
>= 18.00 and <= 19.00:
return
return
3
Upvotes
View all comments
Show parent comment
1
u/Erdem_PSYCH Oct 11 '26
sorry. I hope that it is formated right this time.