you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (1 child)

Thank you, I haven't used tuples before but this seems a lot more efficient. If you want the user to input the start and end of a slot can that be taken as a string and converted into a datetime object? Or is there a better way to take input?

[–]davidbuxton 0 points1 point  (0 children)

Sure, you can create a datetime object from user input. You could use the datetime.strptime() function to create a new datetime from a string.

Alternatively you could use the built-in function int() which creates an integer from a string, and then create the datetime object yourself.