Maths
line-by-line explanation of your math operations in Python:
#!/bin/python3Shebang line: tells the system to use the Python 3 interpreter.
#mathA comment indicating that the following lines perform math operations.
Math operations:
print(50 + 50) # Addition → 100
print(60 - 50) # Subtraction → 10
print(50 * 50) # Multiplication → 2500print(50 + 50 - 50 * 50 / 50)
# Order of operations (PEMDAS):
# 50 * 50 = 2500
# 2500 / 50 = 50
# 50 + 50 - 50 = 50
# Final result → 50.0print(50 ** 2) # Exponentiation → 50^2 = 2500
print(50 % 8) # Modulus (remainder) → 50 ÷ 8 = 6 R2 → Result: 2
print(50 / 8) # Division → Result: 6.25
print(50 // 8) # Floor division → Result: 6 (no decimals)✅ Summary of operators used:
+: Addition-: Subtraction*: Multiplication/: Division**: Exponentiation%: Modulus (remainder)//: Floor division (integer result)
#!/bin/python3
#math
print(50 + 50)
print(60 - 50)
print(50 * 50)
print(50 + 50 - 50 * 50 / 50)
print(50 ** 2)
print(50 % 8)
print(50 / 8)
print(50 // 8)
Last updated