So I am doing a cs50 problem that recquires me to transformate a 12-hour format with pm or am to 24-hour format and make introducing minutes optional:
I cant figure out how to read an integr (that is the time) with some str like pm or am.And then can read minutes with the “:” and make them optional that making me see it difficult task to do with a dict and even with a dict list because some things are str some others are integers some are optional and not required in the pattern it seems very criptic to me and if there another way to exchange value from format to another without using dict or dict list i dont see it right now.
and these is the expected output: