#Learning #Python through Chunks. Lets start journey together (Beginner to Master). Lets code together !! #ABCC - Any Body Can CODE Chunk 7: Operators (Math & Basic Actions in Python) Operators let you do things with your variables. We’ll start with the simplest category: arithmetic operators. Let’s keep this ultra‑simple. 🔢 1. Arithmetic Operators These are basic math symbols: +Addition -Subtraction *Multiplication /Division //Floor division %Remainder (mod) **Power/exponent To remember: 7 / 2 # 3.5 (normal division) 7 // 2 # 3 (floor division, drops decimals) 10 % 2 # 0 → even 11 % 2 # 1 → odd 2 ** 5 # 32 3 ** 3 # 27 CODE - Try them x = 10 y = 3 print(x + y) # 13 print(x - y) # 7 print(x * y) # 30 print(x / y) # 3.3333 print(x // y) # 3 print(x % y) # 1 print(x ** y) # 1000 💡 Key things to remember / always gives float // gives integer (drops decimals) % gives remainder ** means power
Python Arithmetic Operators for Beginners
More Relevant Posts
-
Day 15 – Deep Dive into Counter & Probability Simulation in Python Today’s session was focused on exploring the collections.Counter module in depth and understanding how powerful it is for frequency analysis and comparisons. Instead of manually counting elements, I practiced using Counter to simplify and optimize the process. What I worked on today: Understanding Counter Basics Created frequency maps from lists Accessed values like a normal dictionary Used most_common() to: Get all frequency pairs Retrieve top N most frequent elements Updating and Modifying Counts Used update() to add new elements Used subtract() to reduce counts Converted elements() into a list to expand values back into repeated form Operations Between Two Counters Addition of two counters Subtraction between counters Intersection (&) → minimum common values Union (|) → maximum values from both Observed how negative or zero values are handled This helped me understand how Counter behaves mathematically and logically. Probability Simulation – Dice Roll Experiment I also simulated rolling a dice multiple times and: Stored results in a list Counted occurrences using Counter Calculated probability of each side Observed how results approximate real probability with more trials This was a good practical exercise to connect programming with basic probability concepts. Additional Practice Areas Mathematical functions (square root, factorial, power, logarithms) Checking if two words are anagrams using Counter Comparing store sales data using frequency logic Generating secure random passwords with specific conditions Key Takeaways Counter makes frequency-based problems much easier Python modules reduce manual work significantly Simulation helps in understanding probability better Clean logic improves efficiency and readability Step by step, I’m building stronger foundations in Python and problem-solving. #Python #PythonProgramming #Collections #Counter #DataStructures #ProblemSolving #Probability #PythonPractice #DailyLearning #CodingJourney
To view or add a comment, sign in
-
Python isn’t magical. It’s precise. And precision has consequences. Continuing my deep dive into sequences… * with lists can be a little mischievous. grid = [['_'] * 3] * 3 Looks like a clean 3×3 grid. Until you do: grid[1][2] = 'X' And suddenly every row changes. Why? Because * didn’t copy the inner list — it copied the reference to it. The safer version? grid = [['_'] * 3 for _ in range(3)] Now each row is independent. Also interesting: += on lists mutates in place. * with tuples creates a new tuple object with a separate id. And when assigning to a slice, the right side must be iterable: l[2:5] = [100] The more I explore sequences, the clearer it becomes — Still learning... #PythonLearning #BackendEngineering #FinTechCareers
To view or add a comment, sign in
-
I used a simple Python chart today and it reminded me why accuracy can be misleading in machine learning. When a dataset is imbalanced (one class appears way more than the other), a model can look “good” just by predicting the majority class most of the time. Here’s what I did : 1. Plotted the class distribution 2. Checked what a “dumb baseline” accuracy would be if I always predicted the majority class 3. Decided to focus more on Precision, Recall, F1, and ROC-AUC instead of accuracy alone If 90% of the data is one class, a model can get ~90% accuracy while being useless for the minority class (which is often the important one). So, what I've learned is Before training any model, I now always do: Class distribution plot Baseline check Choose metrics that match the real goal ❓ Quick question In a high-stakes problem (fraud, health, risk), would you prioritise precision or recall — and why? #DataScience #MachineLearning #Python #DataVisualization #BuildInPublic
To view or add a comment, sign in
-
-
🚀 𝐃𝐚𝐲 7/60 of 60-𝐃𝐚𝐲 𝐏𝐲𝐭𝐡𝐨𝐧 𝐂𝐡𝐚𝐥𝐥𝐞𝐧𝐠𝐞 🦾 Today's topic is "𝐎𝐩𝐞𝐫𝐚𝐭𝐨𝐫𝐬 (𝐚𝐫𝐢𝐭𝐡𝐦𝐞𝐭𝐢𝐜, 𝐜𝐨𝐦𝐩𝐚𝐫𝐢𝐬𝐨𝐧, 𝐥𝐨𝐠𝐢𝐜𝐚𝐥)" Operators in Python include 𝒂𝒓𝒊𝒕𝒉𝒎𝒆𝒕𝒊𝒄, 𝒄𝒐𝒎𝒑𝒂𝒓𝒊𝒔𝒐𝒏, and 𝒍𝒐𝒈𝒊𝒄𝒂𝒍 𝒐𝒑𝒆𝒓𝒂𝒕𝒐𝒓𝒔 that form the backbone of expressions. Arithmetic operators like +, -, *, /, 𝒂𝒏𝒅 ** perform mathematical computations; comparison operators such as ==, !=, <, >, <=, and >= compare values and return boolean results; and logical operators including and, or, and not combine 𝐛𝐨𝐨𝐥𝐞𝐚𝐧 expressions to control flow. ➡️ + (Addition): Used to sum two or more numbers. ➡️- (Subtraction): Used to subtract the right operand from the left operand. ➡️* (Multiplication): Used to multiply two numbers.The * operator is also used with a string and an integer to repeat the string multiple times (e.g., 'Hi' * 3 results in 'HiHiHi'). ➡️/ (Division): Used to divide the left operand by the right operand. It always returns a floating-point (decimal) number result, even if the division results in a whole number. ➡️** (Exponentiation): Used to raise the left operand to the power of the right operand. For example: arithmetic, comparison, and logical operators ✅ A minimal example demonstrates their use: 𝘢, 𝘣 = 7, 3 𝘴𝘶𝘮_ = 𝘢 + 𝘣 # 10 𝘳𝘢𝘵𝘪𝘰 = 𝘢 / 𝘣 𝘪𝘴_𝘦𝘲𝘶𝘢𝘭 = (𝘢 == 7) # True 𝘷𝘢𝘭𝘪𝘥 = (𝘢 > 𝘣) 𝘢𝘯𝘥 (𝘣 < 5) # True 𝘱𝘳𝘪𝘯𝘵(𝘴𝘶𝘮_, 𝘳𝘢𝘵𝘪𝘰, 𝘪𝘴_𝘦𝘲𝘶𝘢𝘭, 𝘷𝘢𝘭𝘪𝘥) This simple pattern—read input, optionally convert types, and output with `𝒑𝒓𝒊𝒏𝒕()` is the foundation of interactive Python programs. Small concept, but it makes programs feel more real and interactive. Still moving forward, one day at a time. 🚀 #learning #python #consistency #challenge #60days #coding #programming
To view or add a comment, sign in
-
-
🚀 Mini Project: Smart AC Temperature Control using Fuzzy Logic (Python) I built a mini project that simulates an intelligent AC temperature controller using Fuzzy Logic with Python 🧠❄️ 🔍 What This Project Does: Takes Temperature (15°C – 40°C) as input Takes Humidity (0% – 100%) as input Uses Fuzzy Membership Functions (poor, average, good) Applies Fuzzy Rules to determine optimal AC temperature Outputs the most suitable AC setting (16°C – 30°C) 🛠 Tech Stack: Python NumPy Scikit-Fuzzy (skfuzzy) 💡 Concepts Used: Fuzzy Inference System (FIS) Membership Functions Rule-Based Control System ControlSystem & ControlSystemSimulation This project helped me understand how real-world systems handle uncertainty instead of relying only on strict conditions like traditional logic. Instead of: If temperature > 30 → Set AC to 18 We use fuzzy reasoning like: If temperature is good and humidity is high, then AC should be cooler. That’s how smart systems work in real life! 📌 GitHub Repository: 👉 https://lnkd.in/dFcpBcZP I’m currently exploring more in Machine Learning and Intelligent Systems. Open to feedback and discussions 🙌 #Python #MachineLearning #FuzzyLogic #AI #StudentDeveloper #BCA #MiniProject #LearningInPublic
To view or add a comment, sign in
-
🐍 Learning Python – Operators Explained Today, I practiced different types of operators in Python and learned how they are used to perform calculations and make decisions in programs. 📌 Concepts covered in this program: 🔹 Arithmetic Operators Addition, subtraction, multiplication, division Modulus (%) to find remainder Power operator (**) for exponentiation 🔹 Relational Operators Compare values using ==, !=, >, <, >=, <= These operators always return True or False 🔹 Assignment Operators Short-hand operations like +=, -=, *=, /=, %= and **= Helpful for writing clean and efficient code 🔹 Logical Operators and, or, not Used to combine conditions and control program logic 💡 This practice helped me understand how Python makes decisions and performs operations behind the scenes — a core concept for real-world programming. I’m building my Python fundamentals step by step for my journey towards AI & Machine Learning 🚀 Feedback and suggestions are always welcome 😊 #Python #PythonBeginner #OperatorsInPython #LearningPython #CodingJourney #ProgrammingBasics #SoftwareEngineering #AI #MachineLearning
To view or add a comment, sign in
-
🚀 #Day10 of 50 Days of Learning #Python through #Automation In Day 10, I built a simple and powerful automation project — converting text into speech using Python. This project helped me understand how machines generate voice output from text and how Python can be used to build accessibility tools and voice-based applications. 📌 In this blog, I covered: ✅ What Text-to-Speech (TTS) technology is ✅ How the pyttsx3 library works in Python ✅ How Python converts text into audio output ✅ How offline speech engines work ✅ Real-world use cases of text-to-speech systems ✅ A complete working Python script for text-to-speech conversion 💡 This project is beginner-friendly and works completely offline, making it perfect for building voice assistants, accessibility tools, and automation systems. This automation shows how Python can interact with system speech engines — an essential step toward building intelligent and voice-enabled applications. 👉 Read the full blog here: https://lnkd.in/g3tGa4v2 #Python #Automation #TextToSpeech #AI #PythonProjects #100DaysOfCode #PythonLearning #CodingJourney #Developer #VoiceTechnology #Accessibility #Tech
To view or add a comment, sign in
-
Day 23 of my #100DaysOfCode challenge 🚀 Today I implemented Linear Search in Python. Linear Search is the simplest searching algorithm where we check each element one by one until the target element is found. What the program does: • Takes a list and a target value • Iterates through the list sequentially • Returns the index if the target is found • Returns -1 if the target does not exist How the logic works: 1)Define a function linear_search(arr, target) 2)Use a for loop to iterate through the list using indices 3)Compare each element with the target value 4)If a match is found, return the current index 4)If the loop completes without finding the target, return -1 Example: Input: List:[10, 20, 30, 40, 50, 60, 70, 80, 90] Search Target 1: 50 Search Target 2: 100 Output: Target 50 found at index: 4 Target 100 not found in the list. Why Linear Search matters: – Works on both sorted and unsorted arrays – Simple and easy to implement – Time Complexity: O(n) Key learnings from Day 23: – Understanding basic searching algorithms – Comparing Linear Search vs Binary Search – Strengthening fundamentals of iteration – Improving algorithmic thinking #100DaysOfCode #Day23 #Python #PythonProgramming #LinearSearch #Algorithms #DataStructures #ProblemSolving #CodingPractice #LearnByDoing #ComputerScience #InterviewPrep #BTech #CSE #AIandML #VITBhopal #TechJourney
To view or add a comment, sign in
-
-
Let’s test your understanding of Python 👇 a = [1, 2] b = a b.append(3) print(len(a)) What’s the output? 2 3 1 Error 🧠 Take 5 seconds before answering… ✅ Correct Answer: 3 Why? Because this line: b = a Does NOT create a copy. It makes b point to the same list in memory. So when we do: b.append(3) We modify the SAME object. Now the list becomes: [1, 2, 3] And since a and b reference the same object: len(a) = 3 🔥 Key Insight Lists in Python are mutable. Variables store references, not copies (for mutable objects). That’s why small misunderstandings like this cause real bugs in data & AI pipelines. Have you ever been surprised by Python references before? 👇 #Python #AI #DataScience #LearningInPublic #30DayChallenge
To view or add a comment, sign in
-
I used to think learning Data Analytics would feel exciting all the time. Like solving smart problems with cool Python library. But some days? -It’s just me, a messy dataset, and 20 minutes of confusion. -Trying to understand what the question even means. -Trying to figure out why my result looks wrong. Trying to find that one small mistake that changed everything. Most of learning isn’t glamorous. It’s slow. It’s quiet. It’s repetitive. But I’m starting to realize… That’s actually where real understanding builds. #DataAnalytics #Python #LearningJourney
To view or add a comment, sign in
-
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