diff --git a/Images/2.png b/Images/2.png new file mode 100644 index 0000000..ee25c72 Binary files /dev/null and b/Images/2.png differ diff --git a/Images/3.png b/Images/3.png new file mode 100644 index 0000000..5ea278d Binary files /dev/null and b/Images/3.png differ diff --git a/practice2.py b/practice2.py new file mode 100644 index 0000000..211f84c --- /dev/null +++ b/practice2.py @@ -0,0 +1,16 @@ +#EXERCISE 2 - Summing numbers + +def mysum(num): + t = 0 + for num in num: + t += num + return t + + +n = int(input('how many number you want to add')) +list1 = [] +for i in range(0,n): + a = int(input()) + list1.insert(i,a) + +print(mysum(list1)) diff --git a/practice3.py b/practice3.py new file mode 100644 index 0000000..a977cd0 --- /dev/null +++ b/practice3.py @@ -0,0 +1,17 @@ +#EXERCISE 3 - Run timing + +def run_timing(): + totalRuns = 0 + totalTime = 0 + while True: + timing = input('Enter 10 km run time: ').strip() + + if not timing: + break + + totalTime += float(timing) + totalRuns += 1 + averageTime = totalTime / totalRuns + print(f'Average of {averageTime}, over {totalRuns} runs') + +run_timing()