Given your approach to the challenge, I would suggest you check for : first so as to eliminate the last element, and then check for " " in a nested loop. Of course if there is " ", then you are dealing with "3:00 PM" otherwise "3:10". Check the pseudo code below.
FOR each Element in timing:
IF Element has ":":
IF Element has " ":
Handle first element
ELSE:
Handle second element
for i, timer in enumerate(timing):
if “:” in timing[i]:
if " " in timing[i]:
hr1, term = timing[i].split(“:”)
min1, ender = term.split(" “)
else:
hr2, min2 = timing[i].split(”:")
if “:” not in timing[i]:
day = timing[i]
print(day)
print(hr1)
print(min1)
print(hr2)
print(min2)
Error:
File “main.py”, line 19
print(hr1)
^
IndentationError: unindent does not match any outer indentation level
The error message seems clear. You are getting an indentation error. I expected something like:
for time in timing:
if ":" in time:
if " " in time:
print("With space >> " + time)
else:
print("No space >> " + time)
else:
print("No space and No ':' >> " + time)
Just replace the print statements with code depending on whatever it is you want to do with the different times.