From 41597e59cfaf7c622245b7d9e671de57378cf104 Mon Sep 17 00:00:00 2001 From: Ghassan-alabsi <114516088+Ghassan-alabsi@users.noreply.github.com> Date: Tue, 4 Oct 2022 01:32:43 +0200 Subject: [PATCH 1/3] Add files via upload --- answer1.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 answer1.py diff --git a/answer1.py b/answer1.py new file mode 100644 index 0000000..14d4eb3 --- /dev/null +++ b/answer1.py @@ -0,0 +1,18 @@ +list=[] +while True: + item= input("insert your element: ") + list.append(item) + choice= input("press 'Enter' to continue or type 'Quit' to stop inserting!") + if choice.lower() == "quit": + break +print(list) +len= len(list) +num= int(input("write your shifting number? + will shift to the right, - will shift to the lift")) +if num >= 0: + s1= list[len-num:] + s2= list[:len-num] + print(s1+s2) +else: + s3= list[(-len-num):] + s4= list[:(-len-num)] + print(s3+s4) \ No newline at end of file From 3ca02e1b058ad40ef9e22d8cbc2e23a0dd84e79a Mon Sep 17 00:00:00 2001 From: Ghassan-alabsi <114516088+Ghassan-alabsi@users.noreply.github.com> Date: Tue, 4 Oct 2022 21:36:33 +0200 Subject: [PATCH 2/3] Add files via upload --- answer2.py | 7 +++++++ answer3.py | 7 +++++++ 2 files changed, 14 insertions(+) create mode 100644 answer2.py create mode 100644 answer3.py diff --git a/answer2.py b/answer2.py new file mode 100644 index 0000000..a52fb3e --- /dev/null +++ b/answer2.py @@ -0,0 +1,7 @@ +from collections import Counter + +text = input('write a text! ') +d= text.replace(" ","") +letters=[i for i in d] +print(letters) +print(Counter(letters)) diff --git a/answer3.py b/answer3.py new file mode 100644 index 0000000..a22b3a2 --- /dev/null +++ b/answer3.py @@ -0,0 +1,7 @@ +first = input("first word: ") +second = input("second word: ") +set(first) +set(second) +print(set(first).intersection(set(second))) +print(set(first).difference(set(second))) +print(set(second).difference(set(first))) From bc060743ba2f49572b3db0bb3bd84e47fe3249e9 Mon Sep 17 00:00:00 2001 From: Ghassan-alabsi <114516088+Ghassan-alabsi@users.noreply.github.com> Date: Tue, 4 Oct 2022 23:54:39 +0200 Subject: [PATCH 3/3] Add files via upload --- answer4.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 answer4.py diff --git a/answer4.py b/answer4.py new file mode 100644 index 0000000..c70198d --- /dev/null +++ b/answer4.py @@ -0,0 +1,13 @@ +def multi(num1,num2,num3): + x = num1*num2*num3 + return(x) +n1 = int(input("1st number: ")) +n2 = int(input("2nd number: ")) +n3 = int(input("3rd number: ")) +result = multi(n1,n2,n3) +print(f"multiplication result: {result}") + +for i in range(1,result): + if (str(i)== str(i)[::-1]): + m= print(i,end=",") +