# Hack 1 (Python) - Mathematical Functions
def add(a, b):
"""Returns the sum of a and b."""
return a + b
def subtract(a, b):
"""Returns the result of subtracting b from a."""
return a - b
def divide(a, b):
"""Returns the result of dividing a by b."""
return a / b
def modulus(a, b):
"""Returns the remainder when a is divided by b."""
return a % b
def power(a, b):
"""Raises a to the power of b."""
return a ** b
# Example Usage
print(add(6, 3)) # Output: 9
print(subtract(6, 3)) # Output: 3
print(divide(6, 3)) # Output: 2.0
print(modulus(6, 3)) # Output: 0
print(power(6, 3)) # Output: 216
# Output:
# 9
# 3
# 2.0
# 0
# 216
# Hack 2 (Python) - Function to Transform Input
def point_finder(x):
"""Multiplies x by 5, adds 2, and returns the result."""
return (x * 5) + 2
# Example Usage
print(point_finder(-4)) # Output: -18
print(point_finder(5)) # Output: 27
print(point_finder(10)) # Output: 52
# Output:
# -18
# 27
# 52
// Hack 1 (JavaScript) - Mathematical Functions
function add(a, b) {
return a + b;
}
function subtract(a, b) {
return a - b;
}
function divide(a, b) {
return a / b;
}
function modulus(a, b) {
return a % b;
}
function power(a, b) {
return a ** b;
}
// Example Usage
console.log(add(2, 5));
console.log(subtract(2, 5));
console.log(divide(2, 5));
console.log(modulus(2, 5));
console.log(power(2, 5));
// Hack 2 (JavaScript) - Function to Transform Input
function point_finder(x) {
return (x * 5) + 2;
}
// Example Usage
console.log(point_finder(-4));
console.log(point_finder(5));
console.log(point_finder(10));
Cell In[4], line 1
// Hack 1 (JavaScript) - Mathematical Functions
^
SyntaxError: invalid syntax