From 4a95719d58a708ad55b1389631d6339047f786a0 Mon Sep 17 00:00:00 2001 From: standenboy Date: Fri, 15 Dec 2023 10:19:20 +0000 Subject: added existing work --- comp/work/4/pythagorus | 6 ++++++ comp/work/4/sumAndMean | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100755 comp/work/4/pythagorus create mode 100755 comp/work/4/sumAndMean (limited to 'comp/work/4') diff --git a/comp/work/4/pythagorus b/comp/work/4/pythagorus new file mode 100755 index 0000000..d9c5cdc --- /dev/null +++ b/comp/work/4/pythagorus @@ -0,0 +1,6 @@ +#!/usr/bin/python +base = float(input("base: ")) +height = float(input("height: ")) + +hyp = ((base ** 2) + (height ** 2)) ** 0.5 +print(hyp) diff --git a/comp/work/4/sumAndMean b/comp/work/4/sumAndMean new file mode 100755 index 0000000..1d46136 --- /dev/null +++ b/comp/work/4/sumAndMean @@ -0,0 +1,6 @@ +#!/usr/bin/python3 +numbers = [] +for i in range(5): + numbers.append(int(input(f"num {i}: "))) +print(f"sum = {float(sum(numbers))}") +print(f"average = {(sum(numbers) / 5)}") -- cgit v1.2.3