How can I get the day of the week for a given date in Python?

I am working on a project in Python where I need to get the day of the week given a specific date. Can anyone please help me with the code for this? I am a bit stuck and not sure where to start.

Here’s an example date: "2023-05-07."

And here’s some example code that you could use to solve this problem:

Are there any alternative ways to do this? I would appreciate any help or guidance on how to accomplish this. Thank you!