Code Review and Teamwork
52%
Start a Feature the Right Way
Let's add a floor division function. Start by creating a branch and making the change:
git switch -c feature/floor-division
This is the new file content for calculator.py with the floor division function added:
cat << 'EOF' > calculator.py
# calculator.py - A simple calculator
# Hosted on GitLab
import math
def add(a, b):
"""Add two numbers and return the result."""
return a + b
def subtract(a, b):
"""Subtract b from a and return the result."""
return a - b
def multiply(a, b):
"""Multiply two numbers and return the result."""
return a * b
def divide(a, b):
"""Divide a by b and return the result."""
if b == 0:
return "Error: Cannot divide by zero"
return a / b
def power(a, b):
"""Raise a to the power of b and return the result."""
return a ** b
def modulo(a, b):
"""Return the remainder of a divided by b."""Learn Git in a Day
Everything you need, nothing you don'tEnroll now to unlock all content and receive all future updates for free.
Unlock now $9.99$7.49Learn More
Hurry! This limited time offer ends in:
To redeem this offer, copy the coupon code below and apply it at checkout:
