Skip to content

Unleash Python's magic! ✨ This script takes two numbers and performs cool math and comparison ops—perfect for mastering operators! 🚀

Notifications You must be signed in to change notification settings

santoshkhadul/Step_Towards_Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

🚀 Python Arithmetic & Comparison Operations

Welcome to the Python Arithmetic & Comparison Operations script! This fun and simple Python program showcases a variety of basic arithmetic and comparison operations between two numbers, a and b. Whether you're a beginner or an experienced programmer, this code is a great way to understand how different operators work in Python. Let's dive into the world of numbers and operations! ✨

🔥 What Does This Script Do?

The script performs the following operations:

🔢 Arithmetic Operations:

  • Addition: Adds the two numbers (a and b) together.
  • Subtraction: Subtracts b from a.
  • Multiplication: Multiplies the numbers (a and b).
  • Division: Divides a by b and gives the result as a float.
  • Floor Division: Divides a by b and returns the integer part of the result (ignores the decimal part).
  • Modulo: Returns the remainder when a is divided by b.
  • Power: Raises a to the power of b (exponentiation).

🤔 Comparison Operations:

  • Equal to (==): Checks if a is equal to b.
  • Not equal to (!=): Checks if a is not equal to b.
  • Greater than (>): Checks if a is greater than b.
  • Less than (<): Checks if a is less than b.
  • Greater than or equal to (>=): Checks if a is greater than or equal to b.
  • Less than or equal to (<=): Checks if a is less than or equal to b.

🧑‍💻 How to Use It?

  1. Assign values to the variables a and b.
  2. Run the script to get the output of the operations.
  3. See the results of each operation printed to the console. ✨

⚡ Code Example:

# Define numbers
a = 7
b = 2

# Addition
print('Sum: ', a + b)

# Subtraction
print('Subtraction: ', a - b)

# Multiplication
print('Multiplication: ', a * b)

# Division
print('Division: ', a / b)

# Floor Division
print('Floor Division: ', a // b)

# Modulo
print('Modulo: ', a % b)

# Power
print('Power: ', a ** b)

# Comparison Operators
print('a == b =', a == b)
print('a != b =', a != b)
print('a > b =', a > b)
print('a < b =', a < b)
print('a >= b =', a >= b)
print('a <= b =', a <= b)

About

Unleash Python's magic! ✨ This script takes two numbers and performs cool math and comparison ops—perfect for mastering operators! 🚀

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages