From the course: Learning Python (2021)
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Classes - Python Tutorial
From the course: Learning Python (2021)
Classes
- Python is an object-oriented programming language. And this means that you can create and use your own classes. And classes are a really great way of encapsulating functionality that can be kept together and reused as complete modules in other projects. And this can be really helpful in keeping larger programs both maintainable and easier to understand. So let's open up the classes_start file. And let's imagine that we're building an application that manages vehicles, right, the cars and motorcycles and so on. So I'm going to start by defining a class that will hold some information about vehicles. So classes are defined using the class keyword, and then they're given a name. So I'll name my class vehicle. And then I'm going to use two empty parentheses, which are empty for now, but we'll see what those are used for in a moment and then a colon to begin the class scope. Now I need to add the method that gets called when…
Contents
-
-
-
-
Building Hello World9m 5s
-
(Locked)
Variables and expressions11m 44s
-
(Locked)
Python functions11m 52s
-
(Locked)
Conditional structures8m 17s
-
(Locked)
Loops9m 28s
-
(Locked)
Classes10m 30s
-
(Locked)
Importing and using modules2m 22s
-
(Locked)
Using exceptions5m 10s
-
(Locked)
Solution: Palindromes2m 37s
-
-
-
-
-