Create Your Str Class #
In these next lessons, we will learn to implement our own str class to get a better understanding of utilizing a class and common special methods in Python.
Let's take a look at how to create a string object from the str class:
sentence = str("Python is amazing!")
This is what we will try to mimic in this lesson. Let's not think too far ahead and start by implementing a very simple class here.
Exercise #
- Define the
__init__method inside the classMyStrto mimic the behavior of the classstrabove.
Tests #
- Create a new class named
MyStr MyStr("Python is amazing!")should create a new object
Getting Started with Python
Data Types
Python Functions
Statements in Python
Basic Debugging in Python
Basic Algorithm
Object-Oriented Programming
Error Handling
Intermediate Algorithm
Python Modules