Skip to content

chandan-srinivas/Python-Simple-Mini-Projects

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Python-Simple-Mini-Projects

Beginner Python Projects - Calculator, Prime Checker

๐Ÿงฎ Continuous Python Calculator

This is a command-line calculator that allows users to perform unlimited arithmetic operations interactively. It supports addition, subtraction, multiplication, and division with proper error handling, including division by zero and invalid input.


๐Ÿš€ Features

  • Continuous calculation loop until user quits
  • Handles:
    • Addition (+)
    • Subtraction (-)
    • Multiplication (*)
    • Division (/)
  • Input validation for both numbers and operations
  • User-friendly prompts and feedback

๐Ÿ“‚ How to Run

  1. Make sure you have Python installed (python --version).
  2. Save the code in a file, e.g., calculator.py.
  3. Run the script:

Sample Output:

๐Ÿงฎ Welcome to the Continuous Python Calculator! Operations: + for Add | - for Subtract | * for Multiply | / for Divide | q to Quit

Choose operation (+, -, *, /) or 'q' to quit: + Enter first number: 5 Enter second number: 3 Result: 8.0

Choose operation (+, -, *, /) or 'q' to quit: / Enter first number: 10 Enter second number: 0 Result: Error: Cannot divide by zero.

Choose operation (+, -, *, /) or 'q' to quit: q โœ… Calculator closed. Thank you!

๐Ÿ”ข Day 3 Mini Project: Prime Number & Twin Primes Checker

This Python script checks whether a number is a prime, lists all prime numbers from 1 to the given number, and also finds twin prime pairs in that range.


๐Ÿš€ Features

  • โœ… Checks if the entered number is a prime number
  • ๐Ÿ” Lists all prime numbers from 1 to the entered number
  • ๐Ÿงช Identifies and prints twin prime pairs

    (Twin primes are pairs of prime numbers that differ by exactly 2, e.g., (3, 5), (11, 13))


๐Ÿ“‚ How to Run

  1. Make sure Python is installed. Run python --version to check.
  2. Save the script as prime_checker.py.
  3. Run the script in your terminal:

Sample Output:

Enter The Number: 20 No It is not a Prime Number The Prime Numbers from 1 to 20 are: 2 3 5 7 11 13 17 19 Total Prime Numbers From 1 to 20 are: 8 The Twin Prime Numbers From 1 to 20 are: [3, 5] [5, 7] [11, 13] [17, 19]

About

Beginner Python Projects - Calculator, Prime Checker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published