Hello there and welcome to this new section called: 'Learning Python with me'. Today, I will bring you one of the most basic commands, and we will create a name generator using Python. I am very excited to start this project and have you coming along with me! Scenario: We have a friend who has a beer company. He has everything: the product, the manufacturing, and the investment. But he is missing one single thing—the name of the company. He is struggling to think about it and asked us for help to create a name for him. We will use Python to generate two questions and combine them to create his beer company name! What will we use in Python: As you can see in the video, I am starting by leaving notes in Python. However, these notes cannot be left by themselves; they need to be preceded by a "#" symbol, which makes Python understand we are leaving comments instead of writing code. Variables: Variables are containers used to store data values. You create one by giving it a name and assigning a value using the "=" operator. Strings: Strings are sequences of text. In Python, they must be wrapped in either single quotes (' ') or double quotes (" "). Input: input() is a way to get information from the user. It allows the program to 'pause' and wait for you to type something into the console. So, as you can see, we are combining strings and inputs in the video. Why am I mentioning variables if I did not use them in the code? Because variables and strings tend to go together, so I could have used a variable to store and print the strings, something like this: result = ("The beer company name is: " + input("What is your favorite color?: ") + input("What is your favorite animal?: ")) print(result) This works exactly like the example in the video (you can test it). It's just that I put the print statement directly on the same line. As programmers, we want to save as much work as possible, so we keep everything clean and easy to read. I hope you enjoy it!" #Python #PythonProject #personalproject #DataScience #SideProject.
More Relevant Posts
-
Day 12/365: Checking If a List Is a Palindrome in Python 🔁 Today I solved a classic problem in Python: checking whether a list is a palindrome or not — using the two‑pointer technique with a for-else loop. 🔍 How this works step by step: I start with a list l that has elements arranged symmetrically. To check if it’s a palindrome, I compare elements from both ends: l[0] with l[-1], l[1] with l[-2], and so on. I only need to go till the middle of the list: range(len(l)//2) Inside the loop: If any pair doesn’t match, I print "list is not palindrome" and use break to exit the loop early. The interesting part is the for-else: The else block runs only if the loop finishes without hitting a break. That means all pairs matched, so I print "list is palindrome". 💡 What I learned: How to use the two‑pointer technique to compare elements from start and end efficiently. How Python’s for-else works — the else is tied to the loop, not the if. Why we only need to iterate till the middle of the list for palindrome checking. How the same logic can be reused for: checking if a string is a palindrome, validating symmetric data in lists and arrays. Day 12 done ✅ 353 more to go. If you have ideas like: checking palindromes while ignoring cases/spaces in strings, handling mixed data types in lists, or checking palindromes in other data structures, drop them in the comments — I’d love to try them next. #100DaysOfCode #365DaysOfCode #Python #LogicBuilding #TwoPointers #Lists #CodingJourney #LearnInPublic #AspiringDeveloper
To view or add a comment, sign in
-
-
I think dictionaries might be the first Python topic that actually feels like organizing real life. 🐍 Day 08 of my #30DaysOfPython journey was all about dictionaries, and this one felt especially useful because it is basically how Python stores meaningful information. A dictionary is an unordered, mutable key-value data type. You use a key to reach a value — simple, but powerful. Today I explored: 1. Creating dictionaries with dict() built-in function and {} 2. Storing different kinds of values like strings, numbers, lists, tuples, sets, and even another dictionary 3. Checking length with len() 4. Accessing values using key name in [] or get() method 5. Adding and modifying key-value pairs 6. Checking whether a key exists using in operator 7. Removing items with pop(key), popitem() (removes the last item), and del 8. Converting dictionary items with items() which returns a dict_item object that contains key-value pairs as tuples 9. Clearing a dictionary with clear() 10. Copying with copy() and avoids mutation 11. Getting all keys with keys() and values with values(). These will return views - dict_keys() and dict_values() What stood out to me today was how dictionaries make data feel searchable instead of just stored. That key-value structure makes them one of the most practical tools in Python when working with real information. One more day, one more topic, one more step toward thinking in Python instead of just reading Python. When did dictionaries finally stop feeling confusing for you — or are they still one of those topics that need a second look? Github Link - https://lnkd.in/ewzDyNyw #Python #LearnPython #CodingJourney #30DaysOfPython #Programming #DeveloperJourney
To view or add a comment, sign in
-
Stop using + to join strings in Python! 🐍 When you are first learning Python, it is tempting to use the + operator to build strings. It looks like this: name = "Gemini" status = "coding" print("Hello, " + name + " is currently " + status + ".") The Problem? In Python, strings are immutable. Every time you use +, Python has to create a brand-new string in memory. If you are doing this inside a big loop, your code will slow down significantly. The Pro Way: f-strings (Fast & Clean) Since Python 3.6, f-strings are the gold standard. They are faster, more readable, and handle data types automatically. The 'Pro' way: print(f"Hello, {name} is currently {status}.") Why use f-strings? Speed: They are evaluated at runtime rather than constant concatenation. Readability: No more messy quotes and plus signs. Power: You can even run simple math or functions inside the curly braces: print(f"Next year is {2026 + 1}") Small changes in your syntax lead to big gains in performance. Are you still using + or have you made the switch to f-strings? Let’s talk Python tips in the comments! 👇 #Python #CodingTips #DataEngineering #SoftwareDevelopment #CleanCode #PythonProgramming
To view or add a comment, sign in
-
Python: sort() vs sorted() Have you ever had to pause for a second and think: “Do I need sort() or sorted() here?” 😅 This is the common Python confusions. Let’s clear it up. 🔹 list.sort() ◾ A method (belongs to list objects) ◾ Works only on lists ◾ Sorts the list in-place ◾ Changes the original list ◾ Returns None Example: numbers = [3, 1, 4, 2] numbers.sort() print(numbers) # [1, 2, 3, 4] 🔹 sorted() ◾ A function (built-in Python function) ◾ Returns a new sorted list ◾ Does NOT change the original ◾ Works on any iterable Example: numbers = [3, 1, 4, 2] new_numbers = sorted(numbers) print(new_numbers) # [1, 2, 3, 4] print(numbers) # [3, 1, 4, 2] The key difference: sort() → changes your original data sorted() → keeps your original data safe 💡 Quick way to remember: 👉 If you want to keep the original, use sorted() 👉 If you want to modify the list directly, use sort() #Python #Programming #LearnPython #DataScience #LearningJourney #WomenInTech
To view or add a comment, sign in
-
-
F-strings in Python — Not Just Cleaner. Fundamentally Better. Python has had three ways to format strings over its history. If you’ve only learned the language recently, you might not have encountered the older two — but you will, because they still appear in legacy codebases, documentation, and tutorials written before Python 3.6. The first was % formatting, borrowed from C: name = "Andres" print("Hello, %s. You have %d messages." % (name, 5)) It works. But the syntax is cryptic, the order of arguments is error-prone, and it becomes harder to read as soon as you add more than one variable. The second was .format(), introduced in Python 3.0: print("Hello, {}. You have {} messages.".format(name, 5)) An improvement — more explicit, more flexible. But the variables and the placeholders are still separated. To understand what goes where, your eyes have to travel back and forth across the line. Then Python 3.6 introduced f-strings: print(f"Hello, {name}. You have {5} messages.") The variable lives inside the string, exactly where it appears in the output. No positional arguments. No external references. The code reads the way the sentence reads. Beyond readability, f-strings also evaluate expressions directly inline — which means you can do this: hours = 7.5 print(f"Weekly total: {hours * 5} hours") No intermediate variable needed. And in terms of performance, f-strings are consistently faster than .format() because they are parsed closer to compile-time rather than evaluated fully at runtime. Knowing all three methods matters. Understanding why f-strings became the standard tells you something about how Python evolves — always toward clarity. #Python #PythonMOOC2026 #BackendDevelopment #SoftwareEngineering #LearningInPublic #UniversityOfHelsinki
To view or add a comment, sign in
-
-
Most beginners use Python. Very few understand what’s happening behind the scenes. Day 12 — Constructors in Python Today’s focus: controlling how objects are created. Progress in one line: I stopped treating classes like templates… and started thinking like a system designer. Here’s what clicked: • `__init__` isn’t just setup — it defines how your object enters the system • Clean constructors = predictable objects = fewer bugs later • Passing the right parameters early saves hours of patchwork later The confusion? At first, constructors felt like “extra syntax” I had to write. The breakthrough? They’re actually your first layer of control — where structure meets logic. That shift changes how you design everything. Now I’m thinking: “What should this object always have when it’s created?” That’s a different level of thinking. Showing up daily, building with intent — not just running code, but designing it. If you’ve worked with classes before: What’s one mistake you made with constructors early on? Comment “PYTHON” and I’ll share my notes + examples. --- X Post: Most people misuse Python constructors. `__init__` isn’t just setup — it’s control. If your objects are messy, your constructors are weak. Fix that → cleaner code instantly. #Python
To view or add a comment, sign in
-
-
🚀 Day 6: Mastering the Logic of Python | Flow Control Python isn't just about writing code; it's about making decisions. Today was all about Flow Control Statements—the "logical backbone" that transforms a script into an intelligent program. In my latest session, I dived deep into how Python decides how and when code blocks execute. Here’s a breakdown of the Day 6 deep dive: 🧠 The Decision Engine: Conditional Statements I explored how to guide program execution through branching paths: if, if-else, and if-elif-else: Handling everything from simple checks to complex, multi-layered grading systems. match-case (Python 3.10+): A cleaner, more readable "multi-way" decision-maker that feels like a modern switch-case. 🔄 The Engine of Efficiency: Looping Statements Iteration is where the power lies. I practiced: for & while loops: Repeating operations until conditions are met. Loop-Else: A unique Python feature where the else block executes only if the loop finishes normally (without a break). Nested Loops: Essential for processing complex data like matrices and patterns. 🚦 Fine-Tuning Control: Transfer Statements Knowing when to exit or skip is just as important as knowing when to run: break: Immediate exit from a loop. continue: Skipping the current iteration to move to the next. pass: The ultimate "placeholder" that does nothing but keep the syntax valid. 🛠️ Hands-On Logic Building I applied these concepts to solve real-world logic problems: ✅ Finding the biggest of three numbers using nested if..else. ✅ Building a Digit-to-Word converter. ✅ Mathematical validation: Prime Number and Perfect Number checks. ✅ String Reversal logic using both for and while loops. A huge shoutout to my mentor Nallagoni Omkar Sir for emphasizing that it's not just about syntax—it's about clarity, edge cases, and real-world logic. Next Stop: Functions! 🚀 #Python #CorePython #FlowControl #DataScience #LearningInPublic #CodingJourney #PythonProgramming #LogicBuilding #TechCommunity
To view or add a comment, sign in
-
If you work with Python, have you ever wondered: • What is a list comprehension really? • Is it just a shorter for loop? • When should I NOT use it? List comprehensions are not just syntactic sugar, they are a fundamental part of writing Pythonic code. And no, they are not just “shorter loops”. They express intent. That’s the key difference. Let’s look at a simple example: 𝗿𝗲𝘀𝘂𝗹𝘁 = [] 𝗳𝗼𝗿 𝘅 𝗶𝗻 𝗿𝗮𝗻𝗴𝗲(𝟭𝟬): 𝗿𝗲𝘀𝘂𝗹𝘁.𝗮𝗽𝗽𝗲𝗻𝗱(𝘅 * 𝟮) Now, the same code using list comprehension: 𝗿𝗲𝘀𝘂𝗹𝘁 = [𝘅 * 𝟮 𝗳𝗼𝗿 𝘅 𝗶𝗻 𝗿𝗮𝗻𝗴𝗲(𝟭𝟬)] Both do the same thing. But they are NOT the same. When you write: 𝗿𝗲𝘀𝘂𝗹𝘁 = [𝘅 * 𝟮 𝗳𝗼𝗿 𝘅 𝗶𝗻 𝗿𝗮𝗻𝗴𝗲(𝟭𝟬)] You are telling Python: “I am building a new list from an existing iterable”. That intention is explicit. Now, here is where things go wrong: [𝗽𝗿𝗶𝗻𝘁(𝘅) 𝗳𝗼𝗿 𝘅 𝗶𝗻 𝗿𝗮𝗻𝗴𝗲(𝟭𝟬)] This works, but it should not be written like this. Why? Because list comprehensions are meant to create data, not perform side effects. When you use them like this, you are creating a list you don’t need, hiding the real intention of the code, and making it less readable. Takeaway: “List comprehensions are not about writing less code. They are about writing code that clearly expresses transformation.” Use them when you are building data. Avoid them when you are executing actions. #python #listcomprehension #pythonic
To view or add a comment, sign in
-
"pip install …" — Python command or something else? 🤔 Quick question: when you type 👉 `pip install pandas` are you actually writing Python code? Most people assume yes. It *looks* like Python. It's used for Python. But here's the catch: 🚫 It's NOT a Python command. `pip` is a **command-line tool**, not part of the Python language itself. When you run it, you're talking to your system's shell (Terminal, PowerShell, etc.), not the Python interpreter. That's why this fails inside a Python script or notebook cell: ```python pip install pandas # ❌ not valid Python ``` And this works: ```bash pip install pandas # ✅ run in terminal ``` Or, if you want to stay "within" Python environments: ```bash python -m pip install pandas # ✅ recommended ``` 💡 Why this matters (especially in Quarto / Jupyter / workflows): * Each code chunk runs a **specific language engine** (R *or* Python) * Package installation is an **environment step**, not analysis code * Mixing them incorrectly leads to confusing errors 🔥 Pro tip: Think of it like this: * `pip install` → setup phase (outside Python) * `import pandas` → actual Python code (inside your script) Once you see that distinction, a lot of tooling confusion disappears. Have you ever tried running `pip install` inside a script and wondered why it broke? 😅 #Python #DataScience #Programming #CodingTips #DeveloperTools #MachineLearning #AI #TechTips #LearnToCode #SoftwareDevelopment #Jupyter #Quarto #RStats #DataAnalytics #CodingLife #DevCommunity #ProgrammingLife #TechEducation
To view or add a comment, sign in
-
-
Day 2 of #30DaysOfPython ✅ Today's lesson: Python doesn't care how you label things — until it does. I spent today learning variables and data types. Sounds basic. It is basic. But here's what I didn't expect — Python's dynamic typing actually confused me at first. In theory, I knew that x = 5 and x = "five" are both valid. In practice, I accidentally added a string to an integer and got a TypeError I didn't understand for 10 whole minutes. The bug? I was reading user input and forgetting that input() always returns a string. So my "sum" was just two numbers glued together like "510" instead of 15. 🤦 What clicked today: • int, float, str, bool — the four I'll use constantly • type() is your best friend when debugging • Python is forgiving… until you mix types Lesson of the day: Read your error messages. The answer is usually right there. Resources I used: Python.org official docs + a great freeCodeCamp YouTube video. Day 2 done. The bugs are starting early — right on schedule. 😅 👇 What's the sneakiest beginner Python bug you ever ran into? Tell me so I can be prepared! #Python #30DaysOfPython #DataTypes #CodingJourney #TechLearning
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