Afiz โšก๏ธ
Afiz โšก๏ธ

@itsafiz

10 Tweets 6 reads May 27, 2023
Python Basics 101: (with code snippets)
Are you new to Python? Curious about Python's fundamentals? This thread is for you!
A Thread ๐Ÿงต๐Ÿ‘‡
1. Hello World
In Python, print function is used to display anything on the screen.
2. Variables and Data Types
In Python, you can declare variables without specifying their types. Check out this code:
3. Conditionals and Loops
Conditionals help make decisions, while loops let you repeat code.
Here's an example:
4. Functions
Functions let you encapsulate code for reuse.
Here's a simple function:
5. Lists
Lists store multiple values in a single variable.
Check out this code:
6. Dictionaries
Dictionaries store key-value pairs.
Here's an example:
7. Modules
Modules are reusable Python files.
Here's how you can use the math module:
8. File Handling
You can read from and write to files in Python. Here's a basic example:
These examples are just the basics. Feel free to ask if you have any questions in the comments.
Hope you find this thread useful.
Follow me @itsafiz for more Python, ML and AI content.
Like and RT the first tweet to share with your friends.

Loading suggestions...