What Day is it Today?
Welcome on board! In this course, and especially within the next sections you will work with the datetime library that provides powerful functionality to work and deal with dates in Python. Since we are going to work with only dates, we will import only date class from the datetime library.
Let's begin with library loading. Remember, to load a library in Python we need to write import library_name, and to load only specific class use from library_name import class_name.
12# Load class from library from datetime import date
Since we have loaded the library and the class, we can use its methods. For example, imagine we want to call method course from codefinity class. It can be done the next way:
12345# Load class from some_library import codefinity # Call method of this class codefinity.course()
Let's start with a simple task.
Swipe to start coding
Print today's date. Use today() method of date class.
Lösning
Tack för dina kommentarer!
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal
Sammanfatta detta kapitel
Explain code
Explain why doesn't solve task
Awesome!
Completion rate improved to 3.23
What Day is it Today?
Svep för att visa menyn
Welcome on board! In this course, and especially within the next sections you will work with the datetime library that provides powerful functionality to work and deal with dates in Python. Since we are going to work with only dates, we will import only date class from the datetime library.
Let's begin with library loading. Remember, to load a library in Python we need to write import library_name, and to load only specific class use from library_name import class_name.
12# Load class from library from datetime import date
Since we have loaded the library and the class, we can use its methods. For example, imagine we want to call method course from codefinity class. It can be done the next way:
12345# Load class from some_library import codefinity # Call method of this class codefinity.course()
Let's start with a simple task.
Swipe to start coding
Print today's date. Use today() method of date class.
Lösning
Tack för dina kommentarer!
single