👨💻 Learning Machine Learning | Posts about python & ML
🤩 65k+ followers on Insta: https://t.co/kZaBcbHeWY
Mar 2, 2023 • 13 tweets • 4 min read
Inheritance in Python
It is a way of creating a new class by deriving it from an existing class.
With inheritance, the new class inherits all properties and behaviors of the existing class, allowing to reuse code and create classes that build on each other
A thread🧵 #Python
In Python, we can define a class that inherits from another class using the syntax class DerivedClass(BaseClass):
This means that the DerivedClass is inheriting from the BaseClass.
1/10
Feb 28, 2023 • 14 tweets • 5 min read
Objects and Classes in Python🐍
Objects are instances of a class, and classes are the blueprint for creating objects.
In this thread🧵, we'll explore the concepts of objects and classes in depth, along with some examples.
To create a class, we use the class keyword followed by the name of the class. Here's a simple example:
In this example, we've created a class called MyClass with nothing inside it. Let's add some attributes to the class.
1/10
Feb 22, 2023 • 18 tweets • 6 min read
Strings and String Manipulation Methods in Python🐍
Strings in Python are a sequence of characters enclosed in single, double, or triple quotes.
Strings are immutable, which means you cannot change their values after they are created.
Detailed Thread👀🧵
#python#programming
Concatenation of Strings : You can concatenate two or more strings using the "+" operator.
1/16
Feb 21, 2023 • 17 tweets • 6 min read
Loops in Python ⚡🐍
Loops are an essential programming concept that allow you to execute a block of code repeatedly. There are two main types of loops in Python: for loops and while loops.
A for loop allows you to iterate over a sequence of values, such as a list, tuple, or string.
Here's an example that prints each element of a lists
1/10
Feb 20, 2023 • 18 tweets • 7 min read
F-strings in Python : The ultimate usage tips ⚡
F-strings in Python are a concise and powerful way to format strings. You can include any valid Python expression inside the curly braces in an f-string.
Thread 🧵
#Python#programming
To use an f-string, just prefix your string with the letter "f".
Here's an example that uses an f-string to format a variable: