🚀 Excited to share my first Python project – Unlimited Calculator ♾️ Today, as a beginner in Python, I built an Unlimited Calculator that can perform:✅ Addition✅ Subtraction✅ Multiplication✅ Division✅ Solve BODMAS expressions✅ Run continuously until user exits This project helped me understand important Python concepts like:• User input handling• Conditional statements (if-elif-else)• Infinite loops (while loop)• Break statement• Writing real-world logic Here is the code I wrote: print("===== Unlimited Calculator =====") while True: print("\nSelect operation:") print("1. Addition") print("2. Subtraction") print("3. Multiplication") print("4. Division") print("5. BODMAS Expression") print("6. Exit") choice = input("Enter choice (1-6): ") if choice == "1": num1 = float(input("Enter first number: ")) num2 = float(input("Enter second number: ")) print("Result =", num1 + num2) elif choice == "2": num1 = float(input("Enter first number: ")) num2 = float(input("Enter second number: ")) print("Result =", num1 - num2) elif choice == "3": num1 = float(input("Enter first number: ")) num2 = float(input("Enter second number: ")) print("Result =", num1 * num2) elif choice == "4": num1 = float(input("Enter first number: ")) num2 = float(input("Enter second number: ")) if num2 != 0: print("Result =", num1 / num2) else: print("Cannot divide by zero") elif choice == "5": expression = input("Enter expression: ") print("Result =", eval(expression)) elif choice == "6": print("Calculator closed.") break else: print("Invalid choice") 🌱 This is just the beginning of my Python journey. Looking forward to building more projects in Python, Data Science, and Analytics. #Python #Beginner #LearningPython #CodingJourney #Programming #DataScience #WomenInTech
Python Unlimited Calculator Project
More Relevant Posts
-
In Python, a module is a file that contains functions, variables, and classes that we can reuse in our programs. Modules help us organize code and make it more readable and efficient. 📌 Types of Python Modules: 1️⃣ Built-in Modules – Already available in Python Example: math – Mathematical operations random – Generate random numbers datetime – Work with date and time 2️⃣ User-defined Modules – Created by the user to reuse code 3️⃣ Third-party Modules – Installed using pip Example: numpy – Numerical calculations pandas – Data analysis # Python Program Demonstrating int, float, complex, and string Together # Function to perform integer operations def integer_operations(a, b): print("\n--- Integer Operations ---") print("Addition:", a + b) print("Subtraction:", a - b) print("Multiplication:", a * b) print("Division:", a / b) print("Floor Division:", a // b) print("Modulus:", a % b) print("Power:", a ** b) # Function to perform float operations def float_operations(x, y): print("\n--- Float Operations ---") print("Addition:", x + y) print("Subtraction:", x - y) print("Multiplication:", x * y) print("Division:", x / y) print("Rounded Value of First Number:", round(x, 2)) # Function to perform complex number operations def complex_operations(c1, c2): print("\n--- Complex Number Operations ---") print("Addition:", c1 + c2) print("Subtraction:", c1 - c2) print("Multiplication:", c1 * c2) print("Division:", c1 / c2) print("Magnitude of First Complex Number:", abs(c1)) # Function to perform string operations def string_operations(s1, s2): print("\n--- String Operations ---") print("Concatenation:", s1 + " " + s2) print("Uppercase:", s1.upper()) print("Lowercase:", s2.lower()) print("Length of First String:", len(s1)) print("Reversed First String:", s1[::-1]) print("Replace characters:", s1.replace("a", "@")) # Main Program def main(): print("===== Python Data Types Demonstration =====") # Integer input a = int(input("Enter first integer: ")) b = int(input("Enter second integer: ")) integer_operations(a, b) # Float input x = float(input("\nEnter first float number: ")) y = float(input("Enter second float number: ")) float_operations(x, y) # Complex input print("\nEnter complex numbers in form a+bj") c1 = complex(input("Enter first complex number: ")) c2 = complex(input("Enter second complex number: ")) complex_operations(c1, c2) # String input s1 = input("\nEnter first string: ") s2 = input("Enter second string: ") string_operations(s1, s2) print("\n===== Program Completed Successfully =====") # Run the program if __name__ == "__main__": main() #Python #Programming #Coding #LearnPython #Developer #TechSkills
To view or add a comment, sign in
-
-
Day 6: Built-in Functions — Python’s Essential Toolkit 🧰 Every language has a set of "pre-installed" tools. In Python, these are Built-in Functions. You don't need to import anything to use them—they are always there to help you handle data. Today, we are breaking down the most common ones you’ll use in every single script. 1. The Communicators: print() & input() These are your primary ways to talk to your program. print(): Displays data to the console. You can pass multiple items separated by commas: print("Total:", 100). input(): Pauses the program and waits for the user to type something. 💡 The Engineering Lens: Remember that input() always returns a string. If you want to do math with a user's input, you must convert it first! 2. The Measured: len() The Concept: Short for "length." It counts the number of items in a collection (like a string, list, or dictionary). Example: len("Python") returns 6. 💡 The Engineering Lens: len() is incredibly fast ($O(1)$ complexity) because Python keeps track of the size of objects behind the scenes. It doesn't actually "count" the items one by one when you call it. 3. The Transformers: int(), float(), & str() These are used for Type Casting—changing data from one type to another. int(): Converts a value to an integer (whole number). float(): Converts a value to a decimal. str(): Converts a value to a string so you can combine it with other text. 💡 The Engineering Lens: In production, casting is "dangerous." If you try int("abc"), your program will crash. Always ensure your data looks like a number before casting! 4. The Inspector: type() The Concept: Not sure what kind of data a variable is holding? type() will tell you exactly what it is (e.g., <class 'int'>). 💡 The Engineering Lens: While type() is great for quick debugging, we often use isinstance(variable, type) in larger projects because it’s more flexible when dealing with advanced coding patterns. #Python #SoftwareEngineering #CodingBasics #Programming #LearnToCode #CleanCode #TechCommunity #PythonForBeginners
To view or add a comment, sign in
-
### Master Python's input() Function: Make Your Programs Interactive! 💻 This is a fundamental concept for anyone looking to build interactive and user-friendly applications. Key Learnings & Why It Matters: Enables User Interaction : The input() function allows your Python programs to pause and receive data directly from the user during execution. This is essential for building dynamic programs. Example: Imagine a game asking for your character's name: python player_name = input("Enter your hero's name: ") print(f"Welcome, {player_name}!") Program Flow Control : When input() is called, your program waits for the user to type something and press Enter. No further code will execute until input is provided, ensuring your program responds to user commands. How it feels: The program "freezes" at the input line until you press Enter. Crucial Data Type Rule: It's Always a String! : This is a major takeaway! Any data entered via input() is read as a string by default, even if it's a number. Example: If you input 5 into num = input(), Python sees it as the text "5". So, print(num + num) would output 55, not 10! Pro Tip: If you need to perform calculations, remember to type-cast the input to an integer (int()) or float (float()). python age_str = input("Enter your age: ") # User inputs 30 ageint = int(agestr) print(f"Next year you will be {age_int + 1}!") # Outputs "Next year you will be 31!" Enhance User Experience with Prompts : Don't leave your users guessing! Add clear, descriptive messages inside the input() function. This makes your program intuitive and easy to use. Example: city = input("Which city are you from? ") is much better than just city = input(). Handling Multiple Inputs : Learn how to prompt the user for multiple pieces of information, allowing for complex data collection and processing within your programs. Example: python num1 = int(input("Enter the first number: ")) num2 = int(input("Enter the second number: ")) total = num1 + num2 print(f"The sum is: {total}") 💡 Homework Challenge : The video concludes with a great challenge: Write a Python program that takes a student's name and marks for three subjects, then calculates and displays their total percentage. A perfect way to practice what you've learned! --- #Python #PythonTutorial #InputFunction #Programming #Coding #BeginnerFriendly #InteractivePrograms #SoftwareDevelopment #TechSkills
To view or add a comment, sign in
-
When I started learning Python, I used lists for almost everything. But as I progressed, I realized something important: Choosing the wrong data structure can make your code slower, messy, and harder to maintain. While writing this article, I researched and went deeper into understanding how Python data structures actually work behind the scenes — hashing, mutability, and memory behavior — and then tried to simplify those concepts into a beginner-friendly decision guide. 🧠 Choosing the Right Python Data Structure: List, Tuple, Set, or Dictionary In this blog, I explain: • When to use List vs Tuple • Why Sets are powerful for fast lookups • How Dictionaries power real-world systems • A simple decision framework to choose the right structure Writing this blog helped me strengthen both my Python fundamentals and my ability to explain technical concepts clearly. If you're starting your Python journey and want to understand not just what to use but why, this might save you hours of confusion. 🔗 Read here: https://lnkd.in/d2zYBfwi Would love your feedback! Innomatics Research Labs #Python #DataStructures #BeginnerFriendly #LearningInPublic #ArtificialIntelligence #CodingJourney #InnomaticsResearchLabs
To view or add a comment, sign in
-
Tutorial on Python's Conditional Statements (If-Else) In Python allow your program to make decisions and execute specific blocks of code based on whether a given condition evaluates to True or False. They are fundamental for controlling the flow of a program and handling different inputs or scenarios. ### 1. If Statement (2:45) Purpose: The if statement is used to test a single condition and execute a block of code only if that condition evaluates to True. If the condition is False, the code block associated with the if statement is skipped, and nothing is executed. Syntax: python if condition: # Code to be executed if the condition is True Important Points: The code inside the if block must be indented. This indentation is crucial for Python to understand the code structure. Conditions typically involve comparison operators (e.g., > , < , == ) which return a True or False boolean value. Example: python age = 26 if age > 19: print("You are an adult.") # Output: You are an adult. If age was 15, there would be no output. ### 2. If-Else Statement Purpose: The if-else statement provides an alternative block of code to execute if the if condition is False. This ensures that something happens regardless of whether the initial condition is true or false, avoiding empty outputs. Syntax: python if condition: # Code to be executed if the condition is True else: # Code to be executed if the condition is False Important Points: The else block does not require a condition because it automatically executes when the if condition is false. Example: python temperature = 30 if temperature < 25: print("It's a cool day!") else: print("It's a hot day!") # Output: It's a hot day! (since 30 is not less than 25) ### 3. If-Elif-Else Statement Purpose: This statement allows for checking multiple conditions sequentially. It provides a way to handle more complex scenarios where there are several possible outcomes based on different conditions. Python checks conditions from top to bottom, executing the code block for the first True condition it encounters. Syntax: python if condition1: # Code if condition1 is True elif condition2: # Code if condition2 is True (and condition1 was False) else: # Code if all preceding conditions were False Important Points: You can have multiple elif blocks. The else block is optional but provides a fallback for all cases where no if or elif condition is met. Example: python marks = int(input("Enter your marks (out of 100): ")) if marks >= 90: print("Grade A+") elif marks >= 80: print("Grade A") elif marks >= 70: print("Grade B") else: print("Grade C") # Example Input: 77 --> Output: Grade B # Example Input: 91 --> Output: Grade A+ #Python #Programming #ConditionalStatements #IfElse #Coding #TechEducation Continue..
To view or add a comment, sign in
-
Data Structures in Python (Types and Examples Explained) Data structures in Python help organize and store data efficiently in computer memory. They improve performance by making tasks like searching, sorting, and accessing data faster. Common examples include lists, tuples, sets, and dictionaries. Advanced structures like stacks, queues, trees, and graphs help developers manage complex data and build efficient applications. Read more here: https://lnkd.in/ggQg-Giy. #python #datastructures #pythonprogramming #computerscience #TechLearning #softwaredevelopment #ProgrammingBasics #igmguru
To view or add a comment, sign in
-
🖥️ Day 1 of python journey What I learned today: Variables and the 4 core data types. Python has four fundamental types that appear in every program ever written: int — whole numbers. Every user ID, every age, every count, every loop index in every application is an integer. float — decimal numbers. Every price, every percentage, every measurement is a float. One important thing I learned: 0.1 + 0.2 in Python equals 0.30000000000000004, not 0.3. This is a floating-point precision issue that causes real bugs in financial applications. Professional developers use Python's Decimal module for money calculations. str — text. Every API response your application receives, every database field it reads, every message it displays is a string. bool — True or False. The entire logic of every program — every condition, every decision, every filter — is powered by boolean values. The insight that changed how I think about Python: input() always returns a string. Always. Even if the user types 100, Python gives you "100" — the text, not the number. If you try to do arithmetic on it without casting, you get a TypeError. The fix: int(input("Enter your age: ")) — convert the string to an integer immediately. This is the very first thing that trips up beginners. I learned it on Day 1. What I built today: A personal profile program that takes 5 inputs — name, age, city, is_employed, salary — stores them in correctly typed variables, and prints a formatted summary using f-strings: f"Name: {name} | Age: {age} | City: {city}" Simple? Yes. But this exact pattern — collect input, store in typed variables, format and display output — appears in every data entry form, every registration page, every dashboard in every Python application. #Day1#Python#PythonBasic#codewithharry#w3schools.com
To view or add a comment, sign in
-
🚀 Python Daily Playlist — Day 02 Yesterday we learned about Variables — how Python stores information. Today we move to something every Python developer uses constantly: Lists. Lists are one of the most powerful data structures in Python. They allow you to store multiple values in a single variable and manipulate them easily. Think of a list as a container that can hold many items in order. For example: fruits = ["apple", "banana", "mango", "orange"] print(fruits) print(fruits[0]) Output: ['apple', 'banana', 'mango', 'orange'] apple Here’s what makes lists powerful: • They maintain order of items • You can add, remove, or modify values • They work perfectly for loops, data processing, and automation This is why lists are used everywhere in Python — from simple scripts to complex data pipelines. 📌 Quick Revision • Lists store multiple values inside square brackets [] • Each item has an index position starting from 0 • Lists are mutable, meaning they can be changed • We can also Slice the list using "listname[start Index:end index]" 💬 Question for developers: What do you usually store in Python lists most often — numbers, strings, or objects? Let’s discuss in the comments 👇 #PythonLearning #PythonDeveloper #CodingJourney #SoftwareDevelopment #Python
To view or add a comment, sign in
-
Challenge 86 Days Subject: Stop getting Type Errors: A simple guide to Python Type Conversion 🐍 👉 In Python, Type Conversion simply means changing a value from one data type to another—like turning the text "10" (a String) into the actual number 10 (an Integer). 👉 There are two ways this happens: 1. Automatic Conversion (#Implicit) Think of this as Python being smart. It changes the data type on its own to make sure no information is lost. You don’t have to do anything! Example: If you add a whole number (Integer) and a decimal (Float), Python automatically makes the result a decimal. Python a = 10 #Integer b = 1.5 #Float c = a + b #Python automatically makes this 11.5 (Float) 2. Manual Conversion (#Explicit) This is also called Type Casting. This is when you tell Python to change a type using specific functions. 👉 Most common tools: int() – To turn something into a whole number. float() – To turn something into a decimal. str() – To turn something into text. 👉 A Real-Life Example: Adding Prices Imagine you have three prices, but one of them is saved as text: #Python Price1 = 100 # Integer Price2 = 200 # Integer Price3 = "300" #String (because it's in #Quotes) 👉 To add them, we MUST convert Price3 Total = Price1 + Price2 + int(Price3) 👉 Why do we do this? Python processes this line step-by-step. It sees Price1 and Price2 as numbers, but it sees Price3 as just text. Since Python is a "strict" language, it won't let you add text to a number directly. By using int(Price3), you are telling Python: "Hey, take this text "300" and treat it like a real number." 👉 The Result: The #Math: $100 + 200 + 300$ Final Total: 600 Final Type: Integer Big thanks to Parth Verma & The Valuation School for the inspiration! I really appreciate your guidance, Kuldeep Singh Rathore . Thank you for inspiring me to expand my #Knowledge in Python. #Python #CFA #USA #Code #LinkedinLearning #Quantitative #Programming #Softwaredevelopment #Datascience #Dataanalytics #Machinelearning #AI #PythonProject #100daysofcode
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