Creating a Coding educational site #200685
Replies: 1 comment
-
|
💬 Your Product Feedback Has Been Submitted 🎉 Thank you for taking the time to share your insights with us! Your feedback is invaluable as we build a better GitHub experience for all our users. Here's what you can expect moving forward ⏩
Where to look to see what's shipping 👀
What you can do in the meantime 💻
As a member of the GitHub community, your participation is essential. While we can't promise that every suggestion will be implemented, we want to emphasize that your feedback is instrumental in guiding our decisions and priorities. Thank you once again for your contribution to making GitHub even better! We're grateful for your ongoing support and collaboration in shaping the future of our platform. ⭐ |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
🏷️ Discussion Type
Bug
Body
Give me feedback on this lesson called variables and data types
Variables & Data Types
Intro to Programming
When you open a game, something is always happening in the background—even when you’re not pressing anything.
Your score is being tracked.
Your level is being stored.
Your health is being updated.
But here’s the interesting question:
It doesn’t “remember” like a human does. Instead, it stores information in small labeled places inside memory.
These are called variables.
🧠 Variables: The idea behind memory
A variable is simply a name that stores a value.
Think of it like a labeled box.
If you have a box labeled score, you can put a number inside it:
Now the program doesn’t need to remember the number directly. It just remembers the name
score, and looks inside whenever it needs the value.So instead of thinking:
the program thinks:
And the best part?
That value can change.
If the player earns more points:
The same box is updated. The name stays the same, but the value inside changes.
🌍 Why variables matter in real life
Every app you use depends on this idea.
A social media app might store:
A game might store:
A shopping app might store:
Without variables, none of these apps could function. Everything would reset instantly.
📦 What is data?
Before we go deeper, we need to understand what variables store.
That thing is called data.
Data is just information.
It can be anything:
"Seth"159.99TrueSo when you write:
you are storing data (the value) inside a variable (the container).
🔤 Values inside variables
Every variable holds a value.
That value can be different types of information.
For example:
Even though these all look different, they are all just data stored in variables.
🔢 Data Types: how the computer understands data
Now here’s something important:
The computer doesn’t just see “data.” It needs to know what kind of data it is.
That’s what data types are.
A data type tells Python how to treat a value.
🔢 Numbers (Integers)
Whole numbers are called integers.
These are used when you are counting or measuring something simple.
🔢 Numbers with decimals (Floats)
When numbers have decimals, they are called floats.
These are used when precision matters.
🔤 Text (Strings)
Anything inside quotes is text, called a string.
Strings are used for words, sentences, and anything written.
🔘 True or False (Booleans)
Sometimes a value is just yes or no.
In programming, that becomes True or False.
These are used in decisions.
⚪ Empty value (None)
Sometimes, something has no value yet.
This means:
🔁 How variables change over time
Variables are not fixed.
They can update as the program runs.
Think of it like updating a scoreboard in real time.
The label stays the same—but the value changes.
One of the most common mistakes is forgetting that text must be inside quotes.
Python thinks
Sethis a variable, not text.Correct version:
Another mistake is mixing text and numbers incorrectly:
This fails because
"15"is text, not a number.🌍 Real-world mental model
You can think of a program like a system of labeled boxes:
Everything the program does is just:
🧪 Mini challenge (think like a programmer)
Imagine you are building a game.
What variables would you need?
Try to think of:
Now you are already thinking like a developer.
🏁 Summary
If you understand this lesson, you understand one of the most important ideas in programming:
Everything in programming builds on this.
🎯 Final idea
If you strip away all complexity in software:
Games, apps, websites, AI—they are all built from this simple idea.
Beta Was this translation helpful? Give feedback.
All reactions