Files
Buffteks-Website/webpages/input_code.py
2024-09-30 21:39:36 -05:00

12 lines
837 B
Python

# Example 3: Demonstrating basic arithmetic operations
a = 10 # Assigns integer 10 to variable 'a'
b = 3 # Assigns integer 3 to variable 'b'
c = 2.5 # Assigns floating-point number 2.5 to variable 'c'
print('Addition: ', a + b) # Prints the sum of 'a' and 'b'
print('Subtraction: ', a - b) # Prints the result of subtracting 'b' from 'a'
print('Multiplication: ', a * b) # Prints the product of 'a' and 'b'
print('Multiplication: ', a * c) # Prints the product of 'a' and 'c', demonstrating integer-float multiplication
print('Division: ', a / b) # Prints the division of 'a' by 'b', result is a float
print('Floor Division: ', a // b) # Prints the floor division of 'a' by 'b', removing digits after the decimal point
print('Modulus: ', a % b) # Prints the remainder of 'a' divided by 'b'