diff --git a/src/esercizio_somma.py b/src/esercizio_somma.py new file mode 100644 index 0000000..bd6dd9c --- /dev/null +++ b/src/esercizio_somma.py @@ -0,0 +1,16 @@ +#Write a program that takes as input two numbers and print the sum. +# Output: +# Insert the first number: 1 +# Insert the second number: 2 +# Sum: 3 + +def main(): + a = int(input("Insert the first number: ")) + b = int(input("Insert the second number: ")) + print("Sum:", sum(a, b)) + +def sum(a: int, b: int) -> int: + return a + b + +if __name__ == "__main__": + main() diff --git a/tests/test_esercizio_somma.py b/tests/test_esercizio_somma.py new file mode 100644 index 0000000..c95d257 --- /dev/null +++ b/tests/test_esercizio_somma.py @@ -0,0 +1,7 @@ +from src.esercizio_somma import sum + +def test_sum()-> None: + assert sum(3,4) == 7 + assert sum(9,8) == 17 + assert sum(2,3) == 5 + assert sum(88, 100) == 188