+ 1

How to make this code more elegant/pythonic?

Hi everyone! Other than basic exercises, this is my first program! I feel good about it, and I’ve tested that it works. However, it feels inelegant and long. Does anyone have suggestions where it could be improved? Also, it doesn’t validate againt unexpected input so you’ll need 2 inputs to run: 1) an hour of day in the format “7 AM” or “11 PM” (AM and PM in caps and separated from number by one space) and 2) a positive number such as 3 or 548. https://code.sololearn.com/cSg2c57S3O7J/?ref=app

4th Aug 2019, 12:56 PM
RRM
RRM - avatar
3 Answers
+ 1
wow! That code really makes me feel good because it shows that I did get a lot right while also giving me some concrete things to improve and learn more about.
5th Aug 2019, 3:01 AM
RRM
RRM - avatar