Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions automation/sample_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,23 @@ def multiply_two_numbers(a: int, b: int) -> int:
if a < 0 or b < 0:
raise ValueError("Only positive integers are allowed")
return a * b

def divide_two_numbers(a: int, b: int) -> int:
"""Multiply two positive integers together.

Args:
a (int): First positive integer
b (int): Second positive integer

Returns:
int: Product of the two numbers

Raises:
ValueError: If either number is negative
TypeError: If inputs are not integers
"""
if not isinstance(a, int) or not isinstance(b, int):
raise TypeError("Inputs must be integers")
if a < 0 or b < 0:
raise ValueError("Only positive integers are allowed")
return a * b