Day 1/60: Chapter 1 – Intro to Python Python is a fantastic programming language for beginners and experts alike. No matter how complex a program is, it begins with a single line of code. The first line is usually a variable. Variables are like moving boxes — they have a name and content that tell us what’s inside. Topic I – Creating Variables 1. Variable Names: To create a variable, we start by typing its name, like city. If we want a variable name with multiple words, we use snake case, which means using _ to connect the words. For example: home_city. 2. Variable Values: Variables can store all types of values. We use the = sign to store a value inside them. For example: 🧩 Code: city = "Vancouver" "Vancouver" is a string value. How do we know? String values are text written between double quotes. 3. Console: Lines of code are instructions for the computer to follow. The order of instructions matters because the computer reads them line by line. When we use the special instruction print(), we tell the computer to display a value in an area called the console (also known as the shell). We can use the print() instruction as often as we want. The computer displays each value on a new line in the console. 🧩 Code: print("3, 2, 1") print("Hello!") 🖥️ Output in shell: 3, 2, 1 Hello! We can also use print() to display variables, like this: 🧩 Code: name = "Amanpreet Kaur" print(name) 🖥️ Output in shell: Amanpreet Kaur 🧠 Day 1 Challenge: What will be the output of this code? Write in comments. 🧩 Code: name = "Aman" print("name =", name) name = "Kaur" print("name") print(name) #python #programming #ai #bigtech
Python Basics: Variables and Console Output
More Relevant Posts
-
Day 25 of my python learning journey Today’s learning: Understanding how Python classes actually work under the hood. ☞The `*init*` constructor is the first method that runs automatically when we create an object ☞Its main job is to initialize data. We don’t call it — Python calls it for us. ☞ Normal methods are different: we define them for specific tasks and call them manually whenever needed. One runs on its own, the other waits for us. ☞Also learned about the 3 types of variables in Python classes: 1. Instance variable → `self.name` — Each object gets its own separate copy. Change it for one object, others won’t be affected. 2. Static/Class variable → Defined inside class but outside methods. Only one copy exists and all objects share it. 3. Local variable → Created inside a method, used for temporary work, and deleted once the method ends. These small OOP concepts are the building blocks for writing clean, real-world code. Special thanks to the CEO G.R NARENDRA REDDY Sir for constant guidance and motivation. #Python #OOP #LearningJourney #Programming #Coding #StudentLife #100DaysOfCode
To view or add a comment, sign in
-
-
📚 Continuing my Python learning journey Today I focused on understanding lists in Python and explored their features, functions, and practical usage. Key concepts I learned and practiced: ----------------------------------------------------------- ● List basics & features – understanding the list data type and its flexibility ● Built-in functions – using len() and the list() constructor ● Creating lists – from strings, tuples, range(), and creating empty lists ● Type validation – using type() to check data types ●Accessing elements – using index, negative indexing, and slicing (range of indexes) ● Checking existence – verifying if an item exists in a list ● Modifying lists – changing single and multiple items ● Replacing items – updating with more or fewer elements ● Inserting items – adding elements without replacing existing ones using insert() Understanding how flexible lists are makes it clear why they are one of the most widely used data structures in Python. Step by step, I’m building a stronger foundation in Python programming and problem-solving. 🚀 #Python #Programming #LearningJourney #ComputerScience #Coding
To view or add a comment, sign in
-
🚀 Day 14 of Python Learning: Object-Oriented Programming (OOP) in Python Today I learned the basics of Object-Oriented Programming in Python. OOP helps organize code using classes and objects, making programs reusable and scalable. 🔹 What is OOP? OOP is a programming approach where we model real-world entities as objects with data and behavior. 🔸 What is a Class? A class is a blueprint for creating objects. Example: class Student: name = "Rohit" 🔸 What is an Object? An object is an instance of a class. Example: s1 = Student() print(s1.name) 🔸 Using Constructor (init) class Student: def init(self, name, age): self.name = name self.age = age s1 = Student("Rohit", 22) print(s1.name) 🔸 Method Example class Student: def greet(self): print("Hello Student") 💡 Key Learning: Classes define structure, while objects use that structure with real values. 🧪 Practice Task: ✔ Create a Car class ✔ Add brand and model using constructor ✔ Create object and print values ✔ Add one method to display details 🎯 Interview Question: What is the difference between class and object in Python? Answer: A class is a blueprint, while an object is a real instance created from that blueprint. 📌 Day 14 completed — stepping into advanced Python concepts! #Python #Learning #CodingJourney #Day14 #Programming #SDET #100DaysOfCode Masai #dailylearning #masaiverse
To view or add a comment, sign in
-
*Day 26 of my python learning journey* Today I learned about Getter, Setter, and 3 types of methods in Python OOP. *Getter & Setter methods:* Getters are used to access private data safely → `get_name()` Setters are used to update private data with validation → `set_age()` They help protect data and add control over how variables are read or changed. *3 Types of Methods in Python:* 1. *Instance method* → Uses `self`, works with object data. Called by objects. 2. *Class method* → Uses `@classmethod` and `cls`, works with class variables. Called by class. 3. *Static method* → Uses `@staticmethod`, doesn’t use `self` or `cls`. Like a normal function inside class. One more step toward writing clean, secure OOP code. Special thanks to the CEO G.R NARENDRA REDDY Sir for constant guidance and motivation. #Python #OOP #GetterSetter #LearningJourney #Programming
To view or add a comment, sign in
-
-
🚀 Day 19 of Python Learning: Modules and Packages in Python Today I learned how to organize Python code using modules and packages — an important concept for writing scalable and maintainable programs. 🔹 What is a Module? A module is a file that contains Python code (functions, variables, or classes) which can be reused in other programs. 🔸 Example of Module file: mymodule.py def greet(): print("Hello from module") 🔸 Importing Module import mymodule mymodule.greet() 🔸 Import Specific Function from mymodule import greet greet() 🔹 What is a Package? A package is a collection of multiple modules organized in folders. It helps structure large projects. 🔸 Example Structure my_package/ init.py module1.py module2.py 💡 Key Learning: Modules help reuse code, while packages help organize large applications efficiently. 🧪 Practice Task: ✔ Create your own module with 2 functions ✔ Import and use it in another file ✔ Create a simple package with 2 modules ✔ Call functions from both modules 🎯 Interview Question: What is the difference between module and package in Python? Answer: A module is a single Python file, while a package is a collection of modules organized in directories. 📌 Day 19 completed — learning how real projects are structured! #Python #Learning #CodingJourney #Day19 #Programming #SDET #100DaysOfCode Masai #dailylearning #masaiverse
To view or add a comment, sign in
-
Understanding Lambda Functions in Python Today I explored one of the most powerful concepts in Python — Lambda Functions ✨ 👉 What is a Lambda Function? A lambda function is a small, anonymous (no name) function written in a single line. It is mainly used for short and quick operations. 🔹 Syntax: lambda arguments: expression 💡 Where are Lambda Functions used? They are commonly used with built-in functions like: 🔸 filter() → Filters elements based on a condition 🔸 map() → Applies a function to each element 🔸 reduce() → Reduces a sequence to a single value 📌 Examples: ✔️ Filter even numbers ✔️ Square numbers using map() ✔️ Find sum using reduce() 🔥 Why use Lambda? ✅ Cleaner code ✅ Less lines of code ✅ Improves readability for simple logic ✅ Makes operations more efficient 💭 Tip: Lambda functions are best when you need a quick function for a short time. 📚 Learning step by step, growing every day! special thanks to Global Quest Technologies for valuable guidance throughout this journey #Python #Coding #Programming #Learning #Developers #PythonProgramming #TechJourney
To view or add a comment, sign in
-
-
🚀 Day 18 of Python Learning: Abstraction in Python Today I learned about Abstraction in Python — an important Object-Oriented Programming (OOP) concept that focuses on hiding implementation details and showing only essential features. 🔹 What is Abstraction? Abstraction means hiding the internal complexity of a system and exposing only the necessary functionality to the user. 🔸 Why Use Abstraction? ✔ Reduces complexity ✔ Improves code readability ✔ Enhances security by hiding details 🔸 Example Using Abstract Class from abc import ABC, abstractmethod class Shape(ABC): @abstractmethod def area(self): pass class Circle(Shape): def area(self): return 3.14 * 5 * 5 class Rectangle(Shape): def area(self): return 4 * 6 c = Circle() r = Rectangle() print(c.area()) print(r.area()) 💡 Key Learning: Abstract classes define a structure, and child classes must implement the required methods. 🧪 Practice Task: ✔ Create an abstract class Vehicle ✔ Add abstract method start() ✔ Create Car and Bike classes ✔ Implement start() method in both 🎯 Interview Question: What is the difference between abstraction and encapsulation? Answer: Abstraction hides implementation details, while encapsulation hides data and controls access to it. 📌 Day 18 completed — mastering core OOP concepts step by step! #Python #Learning #CodingJourney #Day18 #Programming #SDET #100DaysOfCode Masai #masaiverse #dailylearning
To view or add a comment, sign in
-
Today I explored some advanced concepts in Python functions and variable scope that are super important for writing clean and scalable code 💻✨ 🔹 What I learned today: ✅ Default Arguments → Functions can have predefined values if no argument is passed ✅ Variable Length Arguments → *args → Non-keyword arguments (tuple) → **kwargs → Keyword arguments (dictionary) ✅ Functions, Modules & Libraries → Functions = reusable blocks → Modules = file of functions → Libraries = collection of modules ✅ Types of Variables in Python 🔸 Local Variables → Defined inside a function → Accessible only within that function 🔸 Global Variables → Defined outside functions → Accessible throughout the program 💡 Understanding these concepts helps in writing modular, reusable, and efficient code Consistency is key 🔥 Learning step by step, growing every day 💪 ✨ Write once, reuse everywhere with Python functions! Global Quest Technologies #Python #PythonLearning #Functions #VariableScope #CodingJourney #LearnToCode #Developers #TechSkills #Programming #GlobalQuestTechnologies
To view or add a comment, sign in
-
-
🚀 Day 13 of Python Learning: Exception Handling in Python Today I learned how to handle errors in Python using exception handling. This helps programs run smoothly even when unexpected issues occur. 🔹 What is Exception Handling? Exception handling is used to catch errors and prevent the program from crashing. 🔸 Basic Example try: num = 10 / 0 except: print("Error occurred") 🔸 Handling Specific Error try: number = int("abc") except ValueError: print("Invalid input") 🔸 Using Finally Block try: print("Start") except: print("Error") finally: print("This always runs") 🔸 Using Else Block try: print(10 / 2) except: print("Error") else: print("No error found") 💡 Key Learning: Using try-except makes programs more reliable and user-friendly. 🧪 Practice Task: ✔ Handle divide by zero error ✔ Handle invalid number input ✔ Use finally block in one program ✔ Create a safe calculator using try-except 🎯 Interview Question: What is the purpose of finally block in Python? Answer: The finally block always executes whether an error occurs or not. It is commonly used for cleanup tasks like closing files or database connections. 📌 Day 13 completed — learning how professionals handle errors! #Python #Learning #CodingJourney #Day13 #Programming #SDET #100DaysOfCode Masai #masaiverse #dailylearning
To view or add a comment, sign in
-
📖Learning Python: Conditional Statements. In python journey, understanding conditional statements is essential. They help your program make decisions based on different situations. What are Conditional Statements? They allow your code to execute specific blocks only when a condition is True. 1. if Statement Executes code when a condition is true. Python x = 10 if x > 5: print("x is greater than 5") 2. if-else Statement Chooses between two conditions. Python num = 7 if num % 2 == 0: print("Even") else: print("Odd") 3. if-elif-else Statement Used when you have multiple conditions. Python marks = 85 if marks >= 90: print("Grade A") elif marks >= 70: print("Grade B") else: print("Grade C") 4. Nested if Statement An if inside another if. Python age = 20 if age >= 18: if age >= 21: print("Eligible for everything") else: print("Eligible with some restrictions") #PythonLearning #CodingJourney #Beginners #Programming #DataAnalytics #LearnPython #TechSkills
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