Python Functions!⚙️ Functions help us write reusable and neat code like loops. They are one of the core concepts of python and therefore, today we are going to review what I learned about python functions so far! 👇 👉Basics of functions: grouping statements to perform specific tasks, avoiding repetition, and understanding how to define and call them. ⚙️Parameters & arguments: passing values to functions, using default values, and learning the difference between parameters and arguments. ⚙️Return vs print: how return sends a value back to the caller and print just displays output, and why functions without return give None. ⚙️Recursion: functions calling themselves, importance of base cases, factorial calculation, and printing sequences both forwards and backwards using recursion. 💪Mini exercises: I have added simple and beginner friendly beginner exercises in my jupyter notebook for python functions! Dropping link down below! 😊 😊Good News: My Jupyter Notebook for Python Functions Is Up On My Github! Make sure to check it out and try to do mini projects for python functions that i made there! Good Luck Python Beginners! 😊What Is Coming Next?: Python Lists In detail for Beginners like me! --------------------------- ☺️ Here are Python (Beginner to Intermediate) GitHub Repos for you: 📁Python Variables: https://lnkd.in/e9rjz-_D 📁Python Operators: https://lnkd.in/e6hzgHSn 📁Python Conditionals: https://lnkd.in/egQNGZBF 📁Python Loops: https://lnkd.in/eezUg_-y 📁Python Functions: https://lnkd.in/eKdU6nex ------------------------- ⚡ Follow my learning journey: 📎 GitHub: https://lnkd.in/ehu8wX85 🔗GitLab: https://lnkd.in/eiiQP2gw 💬 Feedback: I’d love your thoughts and tips! 🤝 Collab: If you’re also exploring Python, DM me! Let’s grow together! -------------------------- #pythonfunctions #functionsinpython #pythonforbeginnners #pythonprogramming #pythonfordatascience #pythonformachinelearning
Sidra NL’s Post
More Relevant Posts
-
💪Python DSAs: Linked Lists 🤓Since from today i have started Python DSAs, my first tutorial was about Linked Lists. 👉Linked lists use nodes linked together with pointers and contain data 👉We can play around with the pointers of nodes and perform node insertion and deletion ops on linked lists easily 👀 It is crucial for to understand how nodes and pointers perform in linked lists before we dig deeper into the concept 💭I have to say today was a much productive day since im started with DSAs now, i hope i will be exploring actual field of DS quite sooon! 🫡Until my next post! Happy Coding Fellow Pythonists! ‼️My Python DSAs Repo is up on my GitHub! Check it out for curiousity purposes! -------------------------- ☺️ Here are Python (Beginner to Intermediate) GitHub Repos for you: 📁Python Variables: https://lnkd.in/e9rjz-_D 📁Python Operators: https://lnkd.in/e6hzgHSn 📁Python Conditionals: https://lnkd.in/egQNGZBF 📁Python Loops: https://lnkd.in/eezUg_-y 📁Python Functions: https://lnkd.in/eKdU6nex 📁Python Lists & Tuples: https://lnkd.in/eZ8KiQNs 📁Python Dictionaries & Sets: https://lnkd.in/eDmgj7pc 📁Python OOP: https://lnkd.in/eJFupCiK 📁Python DSAs: https://lnkd.in/ebR3rjkt ------------------------- ⚡ Follow my learning journey: 📎 GitHub: https://lnkd.in/ehu8wX85 🔗 GitLab: https://lnkd.in/eiiQP2gw 💬 Feedback: I’d love your thoughts and tips! 🤝 Collab: If you’re also exploring Python, DM me! Let’s grow together! -------------------------- 📞Book A Call With Me: https://lnkd.in/e23BtnR9 -------------------------- #pythondatastructures #pythonalgorithms #pythonlinkedlists #pythonforbeginners #pythonprogramming
To view or add a comment, sign in
-
Python Conditionals!💭 Understanding how programs make decisions is the heart of logic and intelligence. In Python, conditionals let us choose what happens next, based on whether something is True or False. Some commonly used python operators are: 👇 🔹 if / elif / else — build logical branches for multiple outcomes 🔹 Comparison & Logical operators — power every decision 🔹 Nested conditionals — decisions within decisions 🔹 Truthy & Falsy values — how Python decides without explicit booleans 🔹 Equality vs Identity — == vs is 🔹 Ternary conditionals — writing if-else in one line 🔹 Membership checks — using in for smart lookups 💡 Mini Projects In My Jupyter Notebook: 1. Even/Odd Classifier 2. Grading System 3. Traffic Light Logic 4. Number Classifier 😊Good News: My Jupyter Notebook for Python Conditionals Is Up On My Github! Make sure to check it out and try to do mini projects for python conditionals that i made there! Good Luck Python Beginners! 😊What Is Coming Next?: Python Loops & Functions In detail for Beginners like me! Loops and functions can be intimidating for beginners but worry not since i have made elaborative jupyter notebooks for both! --------------------------- ☺️ Here are Python (Beginner to Intermediate) GitHub Repos for you: 📁Python Variables: https://lnkd.in/e9rjz-_D 📁Python Operators: https://lnkd.in/e6hzgHSn 📁Python Conditionals: https://lnkd.in/egQNGZBF ------------------------- ⚡ Follow my learning journey: 📎 GitHub: https://lnkd.in/ehu8wX85 🔗GitLab: https://lnkd.in/eiiQP2gw 💬 Feedback: I’d love your thoughts and tips! 🤝 Collab: If you’re also exploring Python, DM me! Let’s grow together! -------------------------- #pythonconditionals #ifelifelseinpython #ternaryconditionals #nestedconditionals #conditionalswithoperators #pythonbasicknowledge #pythonbasicconcepts #pythonforbeginners #pythonprogramming #pythonfordatascience #pythonforaiml
To view or add a comment, sign in
-
-
🌟 New Blog: Mastering Data Types in Python — The Foundation of Every Code! Every great Python project starts with one thing — understanding data types. In my latest blog, I break down this fundamental concept in a clear, simple, and practical way — perfect for beginners and aspiring data scientists. Here’s what you’ll learn 👇 💡 What are Data Types and why they matter in Python ⚙️ The key types — Integers, Floats, Strings, Lists, Tuples, Sets, and Dictionaries 🧠 How Python handles data behind the scenes 🚀 Real-world examples and interview insights If you’re just starting your Python or Data Science journey, this blog will help you build a strong foundation that makes advanced topics easier to understand later. I explored all of this in my first Medium blog: 👉 “Python and Its Data Types: Where Logic Meets Magic” https://lnkd.in/ghv5jvyX Big Thanks to Vishwanath Nyathani, Kanav Bansal, Raghu Ram Aduri, Supriya Seetharam, Naman Goswami, Harsha Mg for guiding me throughout this journey. #DataAnalytics #Python #DataTypes #LogicMeetsMagic #DataScience #Programming #StudentsWhoCode #MediumBlog #Learning https://lnkd.in/g28NQ4hC
To view or add a comment, sign in
-
💠 Python Control Flow & Conditional Statements :- 💠 What is Control Flow? ➜ Control flow in Python decides the order in which statements are executed based on conditions and loops. • Purpose / Use :- ➢ To make decisions in code ➢ To repeat tasks automatically (loops) ➢ To control program execution dynamically 🔹 if Statement :- ➜ Executes a block of code only if a condition is True. Example :- a = 10 if a > 5: print("a is greater than 5") Output :- a is greater than 5 🔸 if–else Statement :- ➜ Executes one block if the condition is True, otherwise executes the else block. Example :- num = int(input("Enter a number: ")) if num % 2 == 0: print("Even number") else: print("Odd number") Input: 7 Output :- Odd number 🔹 elif Ladder :- ➜ Used to check multiple conditions one after another. If one condition is True, the rest are skipped. Example :- marks = 82 if marks >= 90: print("Excellent") elif marks >= 75: print("Good") elif marks >= 60: print("Average") else: print("Needs Improvement") Output :- Good ➥ Use :- When you need to test several conditions in a sequence. 🔸 Nested if :- ➜ You can use an if statement inside another if. It helps in checking multiple layers of conditions. Example :- x = 10 if x > 5: if x < 15: print("x is between 5 and 15") Output :- x is between 5 and 15 ➥ Use :- When decision-making depends on another condition. 🔹 for Loop :- ➜ Used to repeat a block of code for each item in a sequence (like list, string, or range). Example :- for i in range(5): print(i) Output :- 0 1 2 3 4 ➥ Use :- Best for iterating through lists, tuples, strings, etc. ➢ Example with List :- fruits = ["apple", "banana", "cherry"] for f in fruits: print(f) Output :- apple banana cherry 🔸while Loop :- ➜ Executes a block while the condition is True. Used when you don’t know beforehand how many times the loop should run. Example :- count = 1 while count <= 5: print(count) count += 1 Output :- 1 2 3 4 5 ➥Use :- When looping depends on a condition that changes dynamically. 🔹Loop Control Statements :- Keyword Description break ⟶ Stops the loop immediately continue ⟶ Skips current iteration & moves to next pass ⟶ Placeholder — does nothing (used in empty loops or blocks) Example :- for i in range(5): if i == 3: continue print(i) Output :- 0 1 2 4 🧩 Quick Summary :- if ➜ check a condition if-else ➜ choose between two paths elif ➜ check multiple conditions nested if ➜ layered decisions for ➜ fixed iterations while ➜ condition-based iterations #Python #ControlFlow #IfElse #Loops #ProgrammingBasics #LogicBuilding #Developers #LearnPython #CodeNewbie #PythonLearning
To view or add a comment, sign in
-
Python Basics: Extracting Initials from a Name – A Step-by-Step Guide for Beginners As a Python enthusiast, I love sharing simple code snippets that can help beginners understand the basics of string manipulation. Today, let’s break down a short Python script that extracts the initials from a full name and prints them in uppercase. This is perfect for tasks like generating acronyms or user badges. Here’s the code using the name “Kannan Srinivasan”: name = "Kannan Srinivasan" initials = "".join([word[0].upper() for word in name.split()]) print(initials) When you run this, it outputs: KS Now, let’s explain it step by step for beginners—no prior experience needed! I’ll walk you through what each part does: 1 Assign the name to a variable: name = "Kannan Srinivasan" This creates a string variable called name and stores the full name in it. Strings are just text enclosed in quotes. Here, the name has two words separated by a space. 2 Split the name into words: Inside the code: name.split() The .split() method breaks the string into a list of words using spaces as the separator. For “Kannan Srinivasan”, this gives: ['Kannan', 'Srinivasan']. (A list is like a collection of items, e.g., [item1, item2].) 3 Extract the first letter of each word and make it uppercase: Inside the list comprehension: [word[0].upper() for word in name.split()] This is a “list comprehension”—a compact way to create a new list by looping over the words. ◦ for word in name.split(): Loops through each word in the list from step 2. ◦ word[0]: Gets the first character of the word (index 0, since Python counts from 0). ◦ .upper(): Converts that character to uppercase (e.g., ‘k’ becomes ‘K’). Result: For our name, this creates ['K', 'S']. 4 Join the initials into a single string: "".join(...) The .join() method combines the list of initials into one string. The "" means no spaces or separators between them, so ['K', 'S'] becomes "KS". This is assigned to the variable initials. 5 Print the result: print(initials) This simply outputs the initials to the console: “KS”. In a real app, you could use this for displaying on a profile or generating an avatar. This snippet is concise thanks to Python’s list comprehensions, but it’s a great intro to strings, lists, and methods. Try it yourself in a Python editor like VS Code or an online REPL—change the name and see what happens! #Python #CodingForBeginners #TechTips
To view or add a comment, sign in
-
Day 32 — Python: Modules & User-Defined Modules 🐍 Introduction to Modules What is a Module? A module is a Python file (.py) containing functions, classes, and variables. Modules help organize code into logical sections. Modules let you reuse code across multiple programs. Modules make code more readable and maintainable. Modules support collaborative development. Types of Modules in Python User-Defined Modules — created by you. Built-in Modules — provided by Python (e.g., math, os). (Covered separately.) External Modules — third-party packages installed via pip. This post focuses on user-defined modules and how to use them. Importing Modules in Python — common ways a. Import entire module: import my_module print(my_module.function_name()) b. Import specific items: from my_module import function_name print(function_name()) c. Import with an alias: import my_module as mm print(mm.function_name()) d. Avoid: from my_module import * # can cause name conflicts User-Defined Modules — step-by-step Step 1 — Create the module file my_module.py: def greet(name): return f"Hello, {name}!" pi = 3.14159 Step 2 — Use the module in another file (main.py): import my_module print(my_module.greet("Alice")) print("Value of Pi:", my_module.pi) Import specific function: from my_module import greet print(greet("Bob")) Using an alias: import my_module as m print(m.greet("Charlie")) Python module search path When importing, Python searches: Current directory Directories in sys.path To view or modify: import sys print(sys.path) sys.path.append("C:/path/to/your/modules") # add custom path Using if name == "main" Use this to prevent code from running on import. inside my_module.py def greet(name): return f"Hello, {name}!" if name == "main": print(greet("Alice")) # runs only when file executed directly Run: python my_module.py → executes the block. If imported, the block is ignored. 7) Installing & using external modules Install with pip: pip install requests Example usage: import requests response = requests.get("https://www.example.com") print(response.status_code) ✨ Tip: Start organizing larger projects into packages (folders with init.py) for better structure. 💬 What module will you package into a module next? Share below! ⬇️ #Python #DaysOfCode #PythonModules #CodingJourney
To view or add a comment, sign in
-
🚀Day 10 of my python journey🐍💪 . 🚀 Your Ultimate Python Roadmap to Mastery in 2025!🐍 . . “Consistency beats intensity — a little progress every day adds up to big results!”💯 . . Learning Python can seem overwhelming at first… but with the right roadmap, it becomes an exciting and achievable journey!💪 Here’s a simple step-by-step path to master Python from beginner to advanced: 1️⃣ Basic Syntax – Learn the building blocks: variables, strings, keywords. 2️⃣ Loops & Conditionals – Master control flow with if-else and loops. 3️⃣ Data Types – Understand lists, tuples, sets, and dictionaries. 4️⃣ Functions & Modules – Write reusable and efficient code. 5️⃣ Functional Programming – Level up with lambda, map, filter, and comprehensions. 6️⃣ OOPS & Regex – Grasp the power of Object-Oriented Programming. 7️⃣ Frameworks – Explore Django, Flask, Numpy, and Pandas. 8️⃣ Projects – Apply your knowledge and build real-world solutions!💻 . . Venkata Krishna Komaragiri . #Python #PythonProgramming #DataScience #MachineLearning #AI #Programming #CodingJourney #FullStackDeveloper #WebDevelopment #DeveloperCommunity #100DaysOfCode #PythonRoadmap #LearnCoding #TechTrends #CodeNewbie #SoftwareEngineering #Innovation #FutureSkills #LinkedInLearning #CodeLife
To view or add a comment, sign in
-
-
🚀 My First Python Menu-Driven Project — Simple Calculator 🧮 Today, I’m excited to share my very first menu-driven Python project — a Simple Calculator! 🎉 This project helped me understand how to make interactive programs using loops, conditions, and exception handling. 💡 What I learned: ✅ Creating functions and reusing them effectively ✅ Using while loops to keep programs running until the user chooses to exit ✅ Handling user input safely with try and except blocks ✅ Implementing menu-driven logic for multiple operations ✅ Using Python’s eval() function carefully for BODMAS rule evaluation ✅ Formatting output using f-strings 🧩 Features of My Calculator: 1️⃣ Addition 2️⃣ Subtraction 3️⃣ Multiplication 4️⃣ Division (with ZeroDivisionError handling) 5️⃣ Percentage Calculation 6️⃣ Power Operation 7️⃣ BODMAS Expression Evaluation 8️⃣ Exit Option Here’s a small preview of my code 👇 def menu(): print('### Simple Calculator ###') print('1. Addition\n2. Subtraction\n3. Multiplication\n4. Division\n5. Percentage\n6. Power\n7. BODMAS\n8. Exit') while True: try: menu() choice = int(input('Enter the number (1-8): ')) except ValueError: print('Invalid input! Enter a number.') continue if choice in {1,2,3,4,5,6}: num1 = float(input('Enter number 1: ')) num2 = float(input('Enter number 2: ')) if choice == 1: print('Addition:', num1 + num2) elif choice == 2: print('Subtraction:', num1 - num2) elif choice == 3: print('Multiplication:', num1 * num2) elif choice == 4: print('Division:', num1 / num2 if num2 != 0 else 'Cannot divide by zero!') elif choice == 5: print('Percentage of num1:', num1 / 100, '%') print('Percentage of num2:', num2 / 100, '%') elif choice == 6: print('Power:', num1 ** num2) elif choice == 7: bodmas = input('Enter expression: ') print('BODMAS Result:', eval(bodmas)) elif choice == 8: print('Thank you for using my calculator!') break else: print('please enter between 1 to 8 only!') 🎯 My Learning Goal: I’m continuously improving my Python skills to build a strong foundation for Data Science and Machine Learning. This small step motivates me to take on bigger projects like database systems, data visualization, and ML models soon! 💪 👩💻 If you’re also learning Python, let’s connect and share knowledge! 💬 Suggestions and feedback are always welcome. #Python #CodingJourney #BeginnerProject #MenuDrivenProgram #WomenInTech #LearningInPublic #DataScience #dataAnalyst #engineeringinkannada simple_output:
To view or add a comment, sign in
-
-
🔥 𝗠𝗮𝘀𝘁𝗲𝗿 𝗣𝘆𝘁𝗵𝗼𝗻 𝗶𝗻 𝟮𝟬𝟮𝟱–𝟮𝟬𝟮𝟲 𝘄𝗶𝘁𝗵 𝗧𝗵𝗲𝘀𝗲 𝗠𝘂𝘀𝘁-𝗙𝗼𝗹𝗹𝗼𝘄 𝗚𝗶𝘁𝗛𝘂𝗯 𝗥𝗲𝗽𝗼𝘀𝗶𝘁𝗼𝗿𝗶𝗲𝘀! 🐍🚀 If you’re serious about leveling up your Python game in 2025–2026 — this post is your golden ticket 🎟️ Whether you’re a beginner or an advanced developer, these 8 handpicked repositories will supercharge your coding skills, boost your confidence, and make your GitHub profile stand out! 💪💻 👇 𝗬𝗼𝘂𝗿 𝗥𝗼𝗮𝗱𝗺𝗮𝗽 𝘁𝗼 𝗣𝘆𝘁𝗵𝗼𝗻 𝗠𝗮𝘀𝘁𝗲𝗿𝘆: ① ʀᴀꜱʙᴛ – Python Reference Collection A treasure chest of useful scripts, tutorials, and Python tricks to make your code smarter and cleaner. 🔗 https://lnkd.in/gCsrsKqG ② ᴠɪɴᴛᴀ – Awesome Python A curated list of top Python frameworks, libraries, and tools. Bookmark it — you’ll come back here again and again! 🔗 https://lnkd.in/g_WUKK3F ③ ᴛʀᴀɴᴀɴʜᴋᴍᴀ – Freaking Awesome Python Discover the most popular Python repos ranked by stars & forks. One stop to explore what’s trending in the Python universe! 🔗 https://lnkd.in/ghBdbeuW ④ ᴛʜᴇᴀʟɢᴏʀɪᴛʜᴍꜱ – All Algorithms in Python The ultimate place to learn algorithms by coding them yourself. Every algorithm is explained and implemented beautifully in Python. 🔗 https://lnkd.in/gyCNvGjw ⑤ ᴘʀᴀᴄᴛɪᴄᴀʟ-ᴛᴜᴛᴏʀɪᴀʟꜱ – Project-Based Learning The fastest way to learn — by building real-world projects! Move from theory → practice → mastery with this gem. 🔗 https://lnkd.in/gnQvyBPf ⑥ ᴛʀᴇᴋʜʟᴇʙ – Learn Python A brilliant mix of code examples, explanations, and real-world use cases — perfect for refreshing your fundamentals. 🔗 https://lnkd.in/gRij5nBW ⑦ ᴢʜɪᴡᴇʜᴜ – 100+ Python Challenges Boost your logic and problem-solving with fun, tricky challenges — ideal for interview prep or skill testing. 🔗 https://lnkd.in/g3xfb_e4 ⑧ ʀᴇᴀʟᴘʏᴛʜᴏɴ – The Ultimate Python Guide Your daily-use handbook for installation, configuration, and Python best practices — trusted by developers worldwide. 🔗 https://lnkd.in/g28VYDMm 💡 𝗣𝗿𝗼 𝗧𝗶𝗽: Don’t just scroll — clone, code, and commit. Consistency beats intensity. Even 1 hour a day can redefine your career in 2025–2026! 🚀 𝗦𝘁𝗮𝗿𝘁 𝗧𝗼𝗱𝗮𝘆. 𝗕𝘂𝗶𝗹𝗱 𝗧𝗼𝗺𝗼𝗿𝗿𝗼𝘄. 𝗖𝗼𝗱𝗲 𝗙𝗼𝗿𝗲𝘃𝗲𝗿. 👇 Would you like me to share an advanced roadmap next — to go from Python → Data Engineering / AI Expert using GitHub projects? Comment “YES” if you want it! #Python #GitHub #LearnPython #DataEngineering #MachineLearning #AI #Developers #Coding #PythonProjects #SoftwareDevelopment #Programming #DataScience #OpenSource #CodeNewbie #TechCareers #PythonTips #CloudComputing #Innovation #TechTrends #100DaysOfCode
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