From 122dda6034c4edc308e4119f4fb921398a3861da Mon Sep 17 00:00:00 2001 From: piotrweglinski Date: Wed, 4 Sep 2019 20:13:22 +0200 Subject: [PATCH 1/2] exercises branch --- excercises/__init__.py | 0 excercises/data_structures | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 excercises/__init__.py create mode 100644 excercises/data_structures diff --git a/excercises/__init__.py b/excercises/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/excercises/data_structures b/excercises/data_structures new file mode 100644 index 0000000..2fe786c --- /dev/null +++ b/excercises/data_structures @@ -0,0 +1,34 @@ +============================================================ +Given a list slice it into a 3 equal chunks and rever each list +DATA +sampleList = [11, 45, 8, 23, 14, 12, 78, 45, 89] +RESULT: +Original list [11, 45, 8, 23, 14, 12, 78, 45, 89] +Chunk 1 [11, 45, 8] +After reversing it [8, 45, 11] +Chunk 2 [23, 14, 12] +After reversing it [12, 14, 23] +Chunk 3 [78, 45, 89] +After reversing it [89, 45, 78] +============================================================ +Given a list iterate it and count the occurrence of each element and create a dictionary to show the count of each element +DATA +original_list = [11, 45, 8, 11, 23, 45, 23, 45, 89] +RESULT +Printing count of each item {11: 2, 45: 3, 8: 1, 23: 2, 89: 1} +============================================================ +Iterate a given list and Check if a given element already exists in a dictionary as a key’s value if is - delete it from the list +DATA: +rollNumber = [47, 64, 69, 37, 76, 83, 95, 97] +sampleDict ={'Jhon':47, 'Emma':69, 'Kelly':76, 'Jason':97} +RESULT: +[64, 37, 83, 95] +================== +Remove duplicate from a list and create a tuple and find the minimum and maximum number +DATA +sampleList = [87, 45, 41, 65, 94, 41, 99, 94] +RESULT +unique items [87, 45, 41, 65, 99] +tuple (87, 45, 41, 65, 99) +min: 41 +max: 99 From 64300a63a27e0064d8489f52ce5c2615868c493c Mon Sep 17 00:00:00 2001 From: piotrweglinski Date: Thu, 12 Sep 2019 21:20:50 +0200 Subject: [PATCH 2/2] adde dfunction excercieses --- excercises/functions | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 excercises/functions diff --git a/excercises/functions b/excercises/functions new file mode 100644 index 0000000..e3fb765 --- /dev/null +++ b/excercises/functions @@ -0,0 +1,30 @@ +//================================ +1. Write a Python function to find the Max of three numbers. +//================================ +2. Write a Python function to sum all the numbers in a list. + +Sample List : (8, 2, 3, 0, 7) +Expected Output : 20 +2.* Make the function so that it will work for any given number of arguments (Arguments being int's instead of list) + +//================================ +3. Write a Python program to print the even numbers from a given list + +Sample List : [1, 2, 3, 4, 5, 6, 7, 8, 9] +Expected Result : +2 +4 +6 +8 + + +//================================ +4. Write a function called fizz_buzz that takes a number. + If the number is divisible by 3, it should return “Fizz”. + If it is divisible by 5, it should return “Buzz”. + If it is divisible by both 3 and 5, it should return “FizzBuzz”. + Otherwise, it should return the same number. +//================================ + + +*. Write a Python function to check whether a number is in a given range \ No newline at end of file