From c92a214e5cef7004935cc1d0e8e379cfb30d82d0 Mon Sep 17 00:00:00 2001 From: SefaSAHAN Date: Mon, 3 Oct 2022 23:23:27 +0200 Subject: [PATCH 1/2] added four homework --- four.py | 19 +++++++++++++++++++ home_work_one.py | 24 ++++++++++++++++++++++++ three.py | 20 ++++++++++++++++++++ two.py | 14 ++++++++++++++ 4 files changed, 77 insertions(+) create mode 100644 four.py create mode 100644 home_work_one.py create mode 100644 three.py create mode 100644 two.py diff --git a/four.py b/four.py new file mode 100644 index 0000000..cabf312 --- /dev/null +++ b/four.py @@ -0,0 +1,19 @@ +num1=int(input()) +num2=int(input()) +num3=int(input()) + + +for i in range(1,num1*num2*num3): + if(str(i) == str(i)[::-1]): + if(i>2): + for a in range(2,i): + y = True + if(i%a==0): + y = False + break + if y: + print(i) + +# i really dont understand what is the palindromic number. because of this reason, +# i take this loop from the internet but i understand how it is created. thx + diff --git a/home_work_one.py b/home_work_one.py new file mode 100644 index 0000000..c4f105b --- /dev/null +++ b/home_work_one.py @@ -0,0 +1,24 @@ + + +def shift(a): + list=a + number=int(input()) + if number>0: + c=0-number + b=list[:c] + a=[] + d=-1 + while number>0: + a.append(list[d]) + number-=1 + d-=1 + a.extend(b) + print(a) + elif number<0: + c=list[number-1:] + d=list[:number-1] + c.extend(d) + print(c) + +shift([1,2,3,4,5]) + diff --git a/three.py b/three.py new file mode 100644 index 0000000..8f24531 --- /dev/null +++ b/three.py @@ -0,0 +1,20 @@ +a=set(input()) +b=set(input()) +d=[] +def sort(): + c.sort() + b='' + for i in c: + b+=i + c.clear() + d.append(b) + +c=[] +c.extend(a.intersection(b)) +sort() +c.extend(a-b) +sort() +c.extend(b-a) +sort() + +print(d) \ No newline at end of file diff --git a/two.py b/two.py new file mode 100644 index 0000000..1fd407d --- /dev/null +++ b/two.py @@ -0,0 +1,14 @@ +a=input() +print(a.count('b')) +c=0 +b=len(a) +z=[] +while b>0: + d=(a[c],a.count(a[c])) + if d not in z: + z.append(d) + b-=1 + c+=1 +print(z) + + From c0d4e141e9d22c4824fc95e4f9f048743ad88059 Mon Sep 17 00:00:00 2001 From: SefaSAHAN Date: Mon, 3 Oct 2022 23:31:32 +0200 Subject: [PATCH 2/2] homework done --- four.py | 1 - home_work_one.py | 1 + three.py | 1 - two.py | 2 ++ 4 files changed, 3 insertions(+), 2 deletions(-) diff --git a/four.py b/four.py index cabf312..a5d7d7e 100644 --- a/four.py +++ b/four.py @@ -2,7 +2,6 @@ num2=int(input()) num3=int(input()) - for i in range(1,num1*num2*num3): if(str(i) == str(i)[::-1]): if(i>2): diff --git a/home_work_one.py b/home_work_one.py index c4f105b..749eafb 100644 --- a/home_work_one.py +++ b/home_work_one.py @@ -19,6 +19,7 @@ def shift(a): d=list[:number-1] c.extend(d) print(c) + shift([1,2,3,4,5]) diff --git a/three.py b/three.py index 8f24531..ed06da1 100644 --- a/three.py +++ b/three.py @@ -16,5 +16,4 @@ def sort(): sort() c.extend(b-a) sort() - print(d) \ No newline at end of file diff --git a/two.py b/two.py index 1fd407d..fdb8377 100644 --- a/two.py +++ b/two.py @@ -12,3 +12,5 @@ print(z) + +