Hey folks, welcome!
Welcome to the first article in my new series:
Python – Made Simpler
Why Python?
Unlike C, Python is widely used—and one big reason is libraries.
Python comes with many built-in libraries, and you can import even more depending on what you need. Think of a library as a toolkit that helps you do things faster and easier.
A Real-Life Example: Randomness
Let’s say I’m playing a card game with friends. I never know which card I’ll get next—why? Because it’s shuffled. It’s random!
In Python, we can use something similar: import random as rand
Just like shuffling cards gives you unpredictable results, the random library in Python helps you generate random numbers or make random choices.
In real life, randomness is unpredictable.
In Python, we simulate that randomness using code.
Cool, right? That’s the magic of Python!
Introduction to Variables
Now let’s talk about variables.
Imagine a kitchen shelf with jars:
One jar has sugar, another has salt, another coffee powder.
In programming, think of those jars as variables. Each jar (or variable) stores something inside it—just like a variable stores data.
Syntax Example:
Let’s say we name our jars like this in Python:
jar1 = "Sugar"
jar2 = "Salt"
jar3 = "Coffee powder"
Now, if we want to see what’s inside, we can do:
print(jar1) # Output: Sugar
print(jar2) # Output: Salt
print(jar3) # Output: Coffee powder
Easy, right?
A variable = a label + value. You store something and use it later.
That’s a wrap!
In the next article, we’ll look at types of variables and best practices for naming them.
Happy coding!
If you found this interesting or have suggestions, feel free to comment — I’d love your feedback!
You can refer my book : https://chinmaynataraj.gitbook.io/chinmaynataraj/
Top comments (0)