From e424c2384c2769a6730c05a7e8c67781cf1ede54 Mon Sep 17 00:00:00 2001 From: Serkan KLC Date: Fri, 3 Jun 2022 22:41:17 +0200 Subject: [PATCH] Fenyx Academy Pucoders Week2 Homework --- DictionaryWithList.py | 14 ++++++++++++++ ListChange.py | 22 ++++++++++++++++++++++ NumberOfOccurences.py | 31 +++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 DictionaryWithList.py create mode 100644 ListChange.py create mode 100644 NumberOfOccurences.py diff --git a/DictionaryWithList.py b/DictionaryWithList.py new file mode 100644 index 0000000..cd73abf --- /dev/null +++ b/DictionaryWithList.py @@ -0,0 +1,14 @@ +# Write a Python program that returns the following dictionary with sorted values. +# NOTE: Dictonaries have keys and values. Here the values are lists. So, the returned dictonary +# should have sorted values(list) +data = { 'a': [5, 3, 9, 0, 2, 3, 1], 'b': [4, 7, 5, 1, 2], 'c': [8, 1, 3, 2, 4] } +list_a = [5,3,9,0,2,3,1] +list_b = [4,7,5,1,2] +list_c = [8,1,3,2,4] +list_a.sort() +list_b.sort() +list_c.sort() +data['a'] = list_a +data['b'] = list_b +data['c'] = list_c +print(data) \ No newline at end of file diff --git a/ListChange.py b/ListChange.py new file mode 100644 index 0000000..5929254 --- /dev/null +++ b/ListChange.py @@ -0,0 +1,22 @@ +# Write a Python program which executes following rules on this given list => +# numbers = [2, 3, 5, 7, 11, 13, 17, 19] +# -take an input(number) from the user +# -take out the first element of the list and put it at the end. Do this x times that in the first step the user indicated. +# -print the list +# -(OPTIONAL) make sure there is not an error while taking input + +numbers = [2,3,5,7,11,13,17,19] + +while True: + i = 0 + try: + number_exe = int(input('Please Enter The Number of Execution : ')) + except ValueError: + print("Please Input Integer Only - TRY Again...") + continue + while i