Getting Started with Python Basics 🚀 In the previous posts, we covered: 1. How to install Python on our systems 2. How to install the Playwright package in Python 3. How to create and download a project inside the IDE Now, we will move forward with the core learning. We will be covering the next topics in two sections: 1. Python Basics 2. Pytest Basics In this post, let’s get started with Python Basics. Creating Our First Python Program Let’s create our first Python file: FirstDemo.py To print anything to the console in Python, we use the print keyword. You can run the program by: Right-clicking on the file and selecting Run FirstDemo Or using the shortcut Ctrl + Shift + F10 Comments in Python When writing programs, it is always a good practice to add comments for better readability. In Python, comments start with the # character. Example Code print('hello') # here are the comments I have defined a = 3 print(a) Str = "Hello World" print(Str) b, c, d = 5, 6.4, "Great" Understanding Variables in Python Here, we declared a variable a and assigned the value 3. One key difference between Python and other programming languages is data type declaration. In Java, we must explicitly define the data type: int a = 3; In Python, we do not specify the data type. Python automatically determines the data type at runtime. Python does have data types, but they do not need to be explicitly mentioned while creating variables. Multiple Variable Assignment Python allows defining multiple variables in a single line, which makes the code clean and concise. Indentation Matters in Python Python is highly sensitive to code indentation. Indentation is not just formatting; it defines code structure. Editors like PyCharm enforce proper indentation by default and help ensure coding standards are followed. There are no semicolons at the end of statements in Python. This forms the foundation of Python basics before moving into pytest and Playwright automation. #Python #PythonBasics #LearningPython #TestAutomation #Playwright #Pytest #SDET #QAEngineering #AutomationTesting #SoftwareTesting #LearningJourney
Python Basics: Variables and Data Types
More Relevant Posts
-
I was installing some Python packages with pip yesterday when my friend told me he's using uv now. He said it's much faster and that it's becoming the new thing. That made me wonder—wait, is pip getting replaced? Am I behind on something? I went on Google to check it out. Turns out, a lot of people are actually using uv. There are posts about how fast it is and how it handles dependencies better. So yeah, it's definitely getting popular. Here's what I learned: pip is still the official package installer for Python. It's not going away. When you install Python, pip comes with it. Most projects still use it, and it works just fine. uv is a newer tool that some people prefer because it's faster. Like, noticeably faster when you're installing a bunch of packages. It's built differently and handles some things better than pip. But it's not replacing pip. It's just another option. Why people think pip is done: When something new shows up and people start talking about it, it feels like everyone's switching. But that's not really what's happening. Some teams are trying uv because they need the speed. Others are sticking with pip because it works for them. I also found out why some people write "python -m pip install" instead of just "pip install." It makes sure you're using the right version of pip for your Python setup. Helps avoid weird issues when you have multiple Python versions on your computer. What I think: If you're happy with pip, keep using it. If you want to try uv because you're curious or your builds are slow, go for it. There's no rush to switch just because other people are doing it. You can stay with pip for now. It does what you need. But it's good to know there are other options when you need them. What are you using? Still on pip or have you tried uv? Let me know in the comments. #Python #DataEngineering #SoftwareDevelopment #DevTools
To view or add a comment, sign in
-
-
🚀 GitHub Project | Morse-Like Message Decryption in Python 🐍 I’m excited to share a recent Python project that solves a Morse-like message decryption challenge using recursive backtracking and variable-length encoding logic. 🔍 Problem Summary Given an encrypted message of dots (.) and underscores (_), decode it into all possible valid plaintext messages based on a defined encoding scheme. 🧠 Solution Highlights ✔ Handles variable-length encodings ✔ Uses recursive backtracking to explore all combinations ✔ Generates all valid decodings efficiently ✔ Clean, modular Python implementation 💻 Repository Structure solution.py — Python implementation question.md — Full problem description README.md — Instructions & usage ▶ How to Run python solution.py 📌 Check out the code here: 👉 https://lnkd.in/g9HvrdBQ This project helped me reinforce core concepts such as: ✨ Recursion & Backtracking ✨ String parsing & algorithmic thinking ✨ Designing clean, maintainable Python code I’d love to hear your thoughts and feedback! 👇 #Python #Algorithms #Recursion #Backtracking #Coding #GitHub #SoftwareEngineering #ProblemSolving #DeveloperJourney
To view or add a comment, sign in
-
-
🚀 Full Stack Journey Day 37: Advanced Python - Overriding Behavior & Dynamic Duck Typing! 🦆🐍 Day 37 of my #FullStackDevelopment learning series took a deep dive into core OOP principles in Advanced Python: Method Overriding, the nuances of Constructor Overriding, and the elegance of Duck Typing! ✨ These concepts are vital for building adaptable and dynamically typed applications. Today's crucial advanced OOP topics covered: Method Overriding: Re-emphasized method overriding, where a subclass provides a specific implementation for a method already defined in its superclass. This is fundamental for polymorphism, allowing subclasses to specialize or alter inherited behavior while maintaining the same method signature. Constructor Overriding (Python's Approach): Explored how, while Python doesn't have explicit "constructor overriding" in the same way as methods, a subclass's __init__ method can extend or entirely replace its parent's __init__. We specifically looked at how to correctly call the parent's constructor using super().__init__() to ensure proper initialization of inherited attributes. Duck Typing in Python: Mastered Duck Typing, a key aspect of Python's dynamic nature. Understood the principle: "If it walks like a duck and quacks like a duck, then it must be a duck." This means Python focuses on what an object can do (its methods and properties) rather than its explicit type or class hierarchy. This leads to highly flexible and less coupled code. Understanding these concepts empowers you to write highly polymorphic and maintainable object-oriented code, crucial for any complex full-stack development! 📂 Access my detailed notes here: 👉 GitHub: https://lnkd.in/grVzxyDv #Python #AdvancedPython #OOP #ObjectOrientedProgramming #MethodOverriding #ConstructorOverriding #DuckTyping #Polymorphism #FullStackDeveloper #LearningToCode #Programming #TechJourney #SoftwareDevelopment #DailyLearning #CodingChallenge #Day37 LinkedIn Samruddhi P.
To view or add a comment, sign in
-
-
🚀 Full Stack Journey Day 38: Advanced Python - Encapsulation, Getters & Setters for Robust Classes! 🔐🐍 Day 38 of my #FullStackDevelopment learning series took a deep dive into a core OOP pillar: Encapsulation in Python, and how we achieve it using Getter and Setter methods! 🔒 This principle is vital for bundling data with the methods that operate on that data, controlling access, and protecting an object's internal state. Today's crucial advanced OOP topics covered: Encapsulation in Python: Explored the concept of encapsulation as the bundling of data (attributes) and methods that operate on that data within a single unit (a class). Understood how it hides the internal state of an object from the outside world, allowing only controlled access, which helps prevent accidental modification and improves maintainability. Learned about the convention of using single (_var) and double (__var) leading underscores for "private" (by convention) and "name-mangled" attributes, respectively. Setter Methods: Mastered setter methods. These are special methods used to modify the value of an object's private (or protected) attributes. Setters often include validation logic to ensure that new values are valid before they are assigned, providing a controlled way to update an object's state. Getter Methods: Dived into getter methods. These are used to retrieve the value of an object's private (or protected) attributes. Getters provide a controlled interface for reading an object's state without directly exposing its internal representation. Encapsulation, implemented effectively with getters and setters (or Python's @property decorator for more advanced use), is fundamental for creating secure, maintainable, and robust object-oriented designs. It's a cornerstone skill for any full-stack developer! 📂 Access my detailed notes here: 👉 GitHub: https://lnkd.in/gRCENQ8Z #Python #AdvancedPython #OOP #ObjectOrientedProgramming #Encapsulation #Getters #Setters #DataHiding #FullStackDeveloper #LearningToCode #Programming #TechJourney #SoftwareDevelopment #DailyLearning #CodingChallenge #Day38 LinkedIn Samruddhi P.
To view or add a comment, sign in
-
-
What felt different for me between Python vs JavaScript Python made me rethink how I write logic. Coming from JavaScript, I was used to braces {}, semicolons ;, and writing multiple lines just to express a simple idea. When I started learning Python, one of the first things I noticed was how clean and readable it felt. In Python, the syntax feels closer to plain English, Indentation replaces braces, which forces cleaner structure. I focus more on the problem I’m solving, not the syntax itself. With JavaScript, my mindset was often: “How do I write this correctly? but with Python, it slowly shifted to: “What’s the best logic to solve this problem?” That mindset shift has been powerful for me. Python has helped me slow down, think step-by-step, and write clearer logic skills that apply to any language, not just Python. I’m still learning, still debugging, and still growing but I’m enjoying the process and the new way of thinking what Python is teaching me. For those who have used both Python and JavaScript, which one changed the way you think about coding? #Python #JavaScript #LearningToCode #FullStackJourney #WomenInTech #BuildInPublic #TechGrowth
To view or add a comment, sign in
-
Modules, Packages, and Imports in Python Efficiency in Python isn't just about the logic you write it’s about how you organize it. If you want to move from "scripts" to "software," mastering the hierarchy of code organization is essential. Here is a quick breakdown of the Python ecosystem: 1. The Module: The Atomic Unit A Module is simply a .py file. It’s the smallest unit of organization where you define functions, classes, and variables. - The Goal: Break down massive scripts into manageable, reusable pieces. - The Rule: The filename (minus the .py) becomes the module name. 2. The Package: Higher-Order Logic A Package is a directory that houses multiple modules. While Python 3.3+ supports namespace packages, adding an __init__.py file is still the standard way to signal a package directory. - The Goal: Organize related modules into a hierarchy (like NumPy or Django) to prevent naming conflicts. - The Structure: Packages can contain "subpackages," creating a clean, nested architecture. 3. The Import: The Bridge The import statement is the engine that brings your code to life by connecting definitions to your current workspace. Pro Tip: Choose your style based on readability: - Standard: import module (Keeps namespaces clean) - Alias: import pandas as pd (Saves time/keystrokes) - Direct: from math import pi (Fast access to specific tools) - Relative: from . import utils (Best for internal package references) 💡 Why it matters? This system is the backbone of Namespace Management. It ensures your "math_utils" don't clash with someone else's "math_utils," keeping your codebase scalable and easy to maintain. #Python #DataEngineering #DataScience
To view or add a comment, sign in
-
-
Ever wonder how much memory an empty list takes? How about how long it takes to add two integers in Python? How fast is adding an element to a Python list? How does that compare to opening a file does it usually take less than a millisecond? Are there hidden factors that make these operations slower than expected? When writing performance-sensitive code, which data structures are most appropriate? How much memory does a floating-point number consume in Python? What about a single character or an empty string? Came across a great write-up on this👇 https://lnkd.in/gdWieZhY
To view or add a comment, sign in
-
🐍 Python Course – Day 7 (Functions in Python) 🔹 What is a Function? A function is a block of code that performs a specific task. Instead of writing the same code again and again, we write it once and reuse it. 🔹 Why Functions are Important? Make code clean and organized Avoid repetition Easy to update and debug Used in every real Python project 🔹 Creating a Function In Python, functions are created using the def keyword. def greet(): print("Hello, Python") Explanation: def means define greet is the function name Code inside runs when the function is called 🔹 Calling a Function greet() Explanation: The function executes only when it is called 🔹 Function with Parameters Parameters allow functions to receive data. def greet(name): print("Hello", name) greet("Hashim") Explanation: name is a parameter "Hashim" is an argument 🔹 Function with Return Value A function can return a result. def add(a, b): return a + b result = add(5, 3) print(result) Explanation: return sends value back to the caller Code stops after return 🔹 Function with User Input def square(): num = int(input("Enter number: ")) return num * num print(square()) 🔹 Important Rules ✔ Function name should be meaningful ✔ Indentation is mandatory ✔ A function runs only when called 🔹 Day 7 Practice Task ✅ Create a function to print your name ✅ Create a function to add two numbers ✅ Create a function to check even or odd def check_even(num): if num % 2 == 0: print("Even") else: print("Odd") check_even(10) 🚀 60 Days of Python – Day 7 Completed 🐍 Today I learned Functions in Python – one of the most powerful concepts. What I practiced today: ✔ Creating functions ✔ Passing parameters ✔ Returning values ✔ Writing reusable code def add(a, b): return a + b Writing clean code starts with good functions 💡 Consistency is my biggest strength. #Python #Programming #LearningJourney #Day7
To view or add a comment, sign in
-
Today’s Learning: REST APIs with Python (Hands-on + Theory + Full Workflow) Today, I spent time learning about REST APIs, how they work, and how to build and interact with them using Python, combining both theoretical concepts and hands-on code examples from multiple tutorials. 📌 What I Covered: • Building a simple API in Python — Learned how to create endpoints that handle HTTP requests and return structured responses, which form the foundation of backend development. • REST API concepts in detail — Explored what REST APIs are, how they follow the REST architectural style, and why they are essential for modern web applications. • Integrating Python with HTML — Learned how to connect backend API logic with frontend HTML, completing the full client–server workflow. 💡 Key Learnings: • REST APIs enable communication between clients and servers using standard HTTP methods such as GET and POST. • Building APIs in Python involves defining routes and handling requests efficiently. • Connecting APIs with frontend interfaces helps create dynamic and interactive applications. This deep dive boosted my confidence in backend development and gave me practical experience toward building real-world applications that communicate seamlessly through APIs. 👾 #RESTAPI #Python #WebDevelopment #Backend #APIDesign #LearningInPublic #TechSkills 🤠
To view or add a comment, sign in
-
-
💻 Day 80: Practicing Python — Understanding Static Methods through a Calculator Class 🧮📘 Today’s learning focused on Object-Oriented Programming (OOP) concepts in Python, especially the use of static methods. By creating a Calculator class, I practiced implementing basic arithmetic operations in a clean and structured way without relying on object instances. This practice helped me clearly understand when and why static methods are used, similar to how we use functions inside topics like decorators, where behavior is defined independently of object data. 🧠 Concepts I learned today: ✔ What a static method is in Python ✔ How @staticmethod works ✔ Difference between instance methods, class methods, and static methods ✔ Why static methods do not require self or cls ✔ How static methods improve code organization and reusability 📌 Theory: Static Methods in Python A static method belongs to a class, not to any specific object. It does not access instance variables (self) or class variables (cls). It is used when a method’s logic is related to the class but does not depend on object data. Declared using the @staticmethod decorator. Similar to utility functions, but logically grouped inside a class. 👉 Just like in the decorators topic, where we define behavior without depending on object state, static methods define functionality without relying on class or instance data. 🧠 Today I practiced: 1️⃣ Writing a Python program to create a Calculator class 2️⃣ Implementing basic operations like addition, subtraction, multiplication, and division using static methods 3️⃣ Calling static methods directly using the class name ✨ What I improved today: 🔹 Strong understanding of static methods 🔹 Better clarity on OOP design principles 🔹 Learned how to group related logic inside a class 🔹 Improved code readability and structure 🔹 Confidence in using decorators like @staticmethod Today’s session strengthened my understanding of Python OOP concepts and how decorators like static methods help write clean, organized, and reusable code 💡🐍 👨🏼🏫 Guided by: Grateful to Rudra Sravan Kumar sir and the 10000 Coders team for their continuous support and guidance. 🌱 Learning OOP step by step — one concept at a time! 🚀 #Day80 #Python #StaticMethod #Decorators #OOP #CalculatorClass #10000Coders #PythonPractice #LearningJourney
To view or add a comment, sign in
-
More from this author
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