Click here to Skip to main content
15,901,426 members

Comments by Member 13949923 (Top 7 by date)

Member 13949923 19-Jul-19 10:45am View    
thank you so much for all the help, solved it now.
Member 13949923 19-Jul-19 9:14am View    
Deleted
hey again Richard. I have changed my code. Got rid of True or False but I still only get my first if statement. Al the other statements are ignored. Is there something wrong with my syntax?

for key, value in hourly_dates.items():
if key in first_indices:
if value == morning_hours:
today_date.append('09:00:00')
else:
if value == noon_hours:
today_date.append('11:00:00')
else:
if value == evening_hours:
today_date.append('19:00:00')
else:
if value == night_hours:
today_date.append('21:00:00')
return today_date

p.s the indentations are like the original code above not like in this comment
Member 13949923 19-Jul-19 7:34am View    
hourly_dates = {'morning': morning_hours, 'noon': noon_hours, 'afternoon': afternoon_hours, 'evening': evening_hours, 'night': night_hours}

If the there is an input such a 'Today evening' and the datetime is in the 'evening' parameter(between 18:00:00 - 21:00:00) it returns 'True' and then prints [current date '19:00:00'] but if input is 'Today morning' it should get 'False' for the first if statement 'Value == True' and then move to second if statement (Value == 'morning_hours') after else statement and so on. But when I input 'Today noon' it does not move to next if statement that has the 'Value == noon_hours'. It just keep printing if statement of 'morning_hours' and don't move the next statement.
Member 13949923 18-Jul-19 6:48am View    
I think u might be on to something here but I don't fully get it. Would be kind and reformulate what u mean?
Member 13949923 18-Jul-19 6:46am View    
I have tried debugging myself and with Visual Studio with no veil. Because my code returns an answers [current date '09:00:00'] although I ask for [current date '11:00:00'], the debug shows no problem. I think my problem is with the logic syntax of Python. It should go to next if statement after "value == morning_hours" shows False. But it doesn't.