From the course: Python Essential Libraries

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution: Pendulum

Solution: Pendulum - Python Tutorial

From the course: Python Essential Libraries

Start my 1-month free trial

Solution: Pendulum

(upbeat music) - [tutor] All right, so, how did you do? Were you able to get a working solution? Let's take a look at how I chose to solve the challenge. And keep in mind, that what is important here is not whether your code matches mine. What's important is that you realize that there are usually multiple ways of solving a given programming problem. And your solution, if it works, that's great. It doesn't need to be the same as mine. So let's go ahead and open up the challengesolution.py file and go over the code. All right, so of course, I import the Pendulum library. And then my code figures out what today is by using the pendulum today function. And remember, we saw that earlier in the chapter. I then use a custom format string to print out the date. And notice that the format I'm using is the full day name, the month, and then there is this Do token which prints out the suffix for the day number. And that's what…

Contents