🚀 Python Variables Explained (Beginner Friendly) Today I practiced Python variables and naming conventions 1. Basic Variable Declaration name = "Ankaj" age = 36 salary = 50000 print("Name:", name) print("Age:", age) print("Salary:", salary) 2. Variable Naming Rules user_name = "Ankaj" age1 = 25 _salary = 30000 print(user_name) print(age1) print(_salary) 3. Constants Convention (Uppercase) PI = 3.14 MAX_SPEED = 120 COMPANY_NAME = "ABC Pvt Ltd" print(PI) print(MAX_SPEED) print(COMPANY_NAME) Key Learnings: * Variables store data values * Naming rules matter in clean code * Constants are written in UPPERCASE by convention I’m building my Python skills step by step Follow Ankaj Python Hub for my daily learning journey #Python #Coding #LearnPython #100DaysOfCode #Programming
Python Variables Explained for Beginners
More Relevant Posts
-
🚀 Python Variables Explained (Beginner Friendly) Today I practiced Python variables and naming conventions 1. Basic Variable Declaration name = "Ankaj" age = 36 salary = 50000 print("Name:", name) print("Age:", age) print("Salary:", salary) 2. Variable Naming Rules user_name = "Ankaj" age1 = 25 _salary = 30000 print(user_name) print(age1) print(_salary) 3. Constants Convention (Uppercase) PI = 3.14 MAX_SPEED = 120 COMPANY_NAME = "ABC Pvt Ltd" print(PI) print(MAX_SPEED) print(COMPANY_NAME) Key Learnings: * Variables store data values * Naming rules matter in clean code * Constants are written in UPPERCASE by convention I’m building my Python skills step by step Follow Ankaj Python Hub for my daily learning journey #Python #Coding #LearnPython #100DaysOfCode #Programming
To view or add a comment, sign in
-
Most Python beginners use lists for everything. That's a mistake. 🐍 Here's when to use each: 📋 List → ordered, changeable collection items = ["a", "b", "c"] → use when data changes 🔒 Tuple → ordered, fixed, faster than list point = (10, 20) → use for data that never changes 🗂️ Dict → key-value pairs, fast lookup user = {"name": "Ritikesh", "age": 20} → use for structured data Simple rule: → Data changes over time? List → Data is fixed? Tuple → Data has labels? Dict Which one do you use most? 👇 #Python #PythonTips #LearnPython #DataStructures #PythonDeveloper #CleanCode #Programming #TechStudent #BuildInPublic #100DaysOfCode #IndianDeveloper
To view or add a comment, sign in
-
-
📚 Day 30/130 — Python Variables Today in my Python Programming Series, let’s understand one of the most important basics 👇 🔹 What is a Variable? A variable is a container used to store data values in a program. 🔹 Simple Understanding: 👉 Variable = Name that stores a value 🔹 Example: x = 10 name = "Gowthami" 👉 Here, "x" stores a number and "name" stores text 🔹 Rules for Variables: • Must start with a letter or underscore (_) • Cannot start with a number ❌ • No spaces allowed • Case-sensitive (name ≠ Name) 🔹 Types of Values Stored: • Integer → 10 🔢 • String → "Hello" 📝 • Float → 3.14 📊 • Boolean → True/False ✅ 🔹 Why Variables are Important? • Store data for reuse • Make programs dynamic • Improve readability 🔹 Key Idea: 👉 Variables help us store and use data easily in programs 📊See the diagram below for better understanding 📌 Tomorrow’s Topic: 👉 Python Data Types #Python #Programming #Coding #TechLearning #LearningInPublic #Students #Developer #100DaysOfCode
To view or add a comment, sign in
-
-
Day 2 – Python Basics+ | Functions, Data Structures, and File I/O** Continuing the beginner Python series with 15 new scripts that build on fundamentals and introduce practical, everyday concepts. **Focus areas for Day 2:** Functions, lists, dictionaries, string methods, control flow, and basic file handling. Each file isolates one concept to support focused learning and easy reference. **Day 2 program list:** | Concept | File | | --- | --- | | Function definition & calls | `01_functions_basic.py` | | Built-in list operations | `02_list_operations.py` | | List comprehensions | `03_list_comprehension.py` | | String methods | `04_string_methods.py` | | Dictionary lookups | `05_dictionary_basics.py` | | Dictionaries as counters | `06_count_characters.py` | | `while` loops + `random` | `07_guessing_game.py` | | Return values | `https://lnkd.in/gFhEe698` | | Sets for deduplication | `09_remove_duplicates.py` | | Math with loops | `10_sum_of_digits.py` | | String slicing | `11_slice_examples.py` | | Sorting & edge cases | `12_find_second_largest.py` | | File read/write | `13_file_write_read.py` | | Anagram checking | `14_check_anagram.py` | | Modules `random` & `string` | `15_simple_password_gen.py` | **How to use:** All scripts use only the Python standard library. Clone the repo, ensure Python 3 is installed, and run any file directly: `python 05_dictionary_basics.py` To run everything at once, reuse the Day 1 runner and update the `PROGRAMS` list with the Day 2 filenames. This set is designed for students, self-learners, and instructors who need clear, modular examples for practice or teaching. Repository link in the first comment. Building this as a multi-day series. If you found Day 1 helpful, Day 2 adds the data structures and file handling that most beginners need next. What topic should Day 3 cover — error handling, OOP basics, or working with APIs? #Python #SoftwareEngineering #LearnToCode #Programming #ComputerScience #DataStructures #SoftwareDevelopment #TechEducation #OpenSource #GitHub #Coding #PythonProgramming Thread Link :- https://lnkd.in/gzzpXUid
To view or add a comment, sign in
-
🚀 Automated My Downloads Folder Using Python Today, I built a simple yet useful File Organizer script using Python that automatically sorts files into folders. We often download many files, and our Downloads folder becomes messy. So I created a script to organize it automatically 👇 ✨ What This Script Does • Scans all files in the Downloads folder • Moves .jpg files into an Images folder • Moves .pdf files into a PDFs folder • Helps keep files clean and organized ⚙️ Technologies Used • Python • os module (for file handling) • shutil module (for moving files) 🧠 What I Learned • Working with file systems in Python • Automating real-world tasks • Writing efficient and reusable scripts • Importance of automation in daily life 💡 Key Insight Even small automation scripts can save time and improve productivity. If you have suggestions to improve this script (like handling more file types), I’d love to hear them! 😊 #Python #Automation #Programming #LearningInPublic #DeveloperJourney #Productivity #10000Coders #BuildInPublic
To view or add a comment, sign in
-
How to Create and Write to Text Files in Python Knowing how to write data to files is a fundamental skill in programming, particularly in Python. The code above demonstrates how to create a text file and add content to it using Python's built-in file handling capabilities. In this example, we specify the filename and open it in write mode. If the file doesn't already exist, Python will create it for you. The `with` statement is key here; it ensures that the file is properly closed after the block is executed, even if an error occurs while writing to the file. This best practice helps avoid file corruption and memory leaks. The `write` method is used to insert text into the file. If the file already contains data, using 'w' will overwrite the existing content. To append new content without losing previous data, use 'a' (append mode) instead. This distinction becomes critical when working with persistent data where you want to retain earlier entries. Additionally, proper error handling is essential when working with files. In real applications, you might want to verify if the file opened successfully or handle exceptions that can arise during file operations, leading to more robust code. Quick challenge: How would you modify the code to check if the file opened successfully before writing? #WhatImReadingToday #Python #PythonProgramming #FileHandling #LearnPython #Programming
To view or add a comment, sign in
-
-
Python if Statement — Making Decisions in Code The if statement in Python is used to execute code based on conditions. It helps control the flow of a program. 🔹 Basic Syntax if condition: # code block 🔹 Example age = 18 if age >= 18: print("Eligible to vote") 🔹 if–else num = 5 if num % 2 == 0: print("Even") else: print("Odd") 🔹 if–elif–else marks = 75 if marks >= 90: print("Grade A") elif marks >= 70: print("Grade B") else: print("Grade C") 🔹 Multiple Conditions age = 22 salary = 25000 if age > 18 and salary > 20000: print("Eligible") if statements are essential for: ✔ Decision making ✔ Validations ✔ Filtering logic ✔ Conditional execution #Python #PythonBasics #Coding #LearnPython #DataAnalytics #Programming #IfStatement
To view or add a comment, sign in
-
Let's now talk about Variables in Python. What is a variable? Think of it like a box, you give it a name and store a value inside it. Example: a = 10 name = 'Alice' price = 19.99 Here, a, name, price are all variables in which we have stored some value or data. Simple right? But here's where most beginners make mistakes- naming their variables wrong. There are 3 conventions you need to follow: 1️⃣ First letter should be lowercase (best practice as per PEP8) 2️⃣ Never start a variable name with a number 3️⃣ Never use spaces, use an underscore instead Break any of these and Python will throw an error before your code even runs. Get these right from day one and you'll save yourself a lot of frustration later. #Python #DataAnalytics #data #python #learnpython #dataanalyst #pythonforbeginners
To view or add a comment, sign in
-
-
🐍 Python Data Structures — Know the Difference, Code Smarter If you're learning Python, this is something you *must* get clear 👇 Not all data structures behave the same… and choosing the wrong one can cost you performance ⚡ Here’s a simple breakdown: 🔹 **List [ ]** ✔ Ordered ✔ Mutable ✔ Indexing ✔ Allows duplicates 🔹 **Tuple ( )** ✔ Ordered ❌ Immutable ✔ Indexing ✔ Allows duplicates 🔹 **Set { }** ❌ Unordered ✔ Mutable ❌ No indexing ❌ No duplicates 🔹 **Dictionary { key: value }** ✔ Ordered ✔ Mutable ❌ No indexing (uses keys) ❌ No duplicate keys 💡 Quick Tip: 👉 Use **List** when you need flexibility 👉 Use **Tuple** when data shouldn’t change 👉 Use **Set** when uniqueness matters 👉 Use **Dictionary** for fast key-value lookup The real skill in programming is not just writing code… It’s choosing the *right data structure at the right time.* 🚀 Master this, and your coding becomes cleaner, faster, and more efficient. #Python #DataStructures #CodingTips #LearnPython #Programming #DeveloperJourney #TechSkills
To view or add a comment, sign in
-
-
Today I explored one of the most powerful data structures in Python – Dictionaries 🐍 📌 Key Takeaways: 🔹 Dictionaries store data in key-value pairs 🔹 Keys are unique, but values can be duplicated 🔹 Easy data access using keys 🔹 Efficient for storing structured data 💡 Important Operations Covered: ✔️ Creating dictionaries using {} and dict() ✔️ Accessing values using keys and .get() ✔️ Removing elements using del, .pop(), .clear() ✔️ Understanding dictionary length using len() ✔️ Using .popitem() to remove the last inserted item 📊 Dictionaries are widely used in real-world applications like: ➡️ JSON data handling ➡️ APIs ➡️ Database-like structures Learning dictionaries strengthens the foundation for real-world Python development 💻 🔥 Consistency is the key — one step closer to mastering Python! Global Quest Technologies ✨ #GlobalQuestTechnologies #GQT #Python #PythonProgramming #100DaysOfCode #CodingJourney #LearnPython #DataStructures #Programming #Developer #CodingLife #TechLearning #SoftwareDevelopment #PythonBasics #CareerGrowth
To view or add a comment, sign in
-
Explore related topics
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development