From the course: Python Quick Start
Unlock this course with a free trial
Join today to access over 24,500 courses taught by industry experts.
Using modules in Python - Python Tutorial
From the course: Python Quick Start
Using modules in Python
A critical skill in programming is knowing how to reuse. And by reuse, I mean take advantage of code that has already been written. In Python, one of the main ways to do this is by using modules and modules contain code that has already been written. I'm going to help you learn how to make use of modules when you code. Calendar is a module in Python that allows you to output calendars and provides other useful calendar-related functions. By default, the calendars that this module outputs have Monday as the first day of the week and Sunday as the last day of the week. When a date is provided as input to a function in the calendar module, the date is provided in the form of integers. And this module uses the current Gregorian calendar. One of the many things you can do with the calendar module is displaying the calendar for a particular month of a particular year. For example, if I wanted to display the calendar for July 2019, I would do this. First I write, "import calendar." This line…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.