From 4757a776179734f004ca2be18cc11a9646c858eb Mon Sep 17 00:00:00 2001 From: Anweshaadas <146619748+Anweshaadas@users.noreply.github.com> Date: Fri, 28 Jun 2024 23:08:03 +0530 Subject: [PATCH 1/4] que1.py --- Task/anwesha das/que1.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Task/anwesha das/que1.py diff --git a/Task/anwesha das/que1.py b/Task/anwesha das/que1.py new file mode 100644 index 0000000..e7b6e66 --- /dev/null +++ b/Task/anwesha das/que1.py @@ -0,0 +1,13 @@ +def frequency(s): + s=s.replace(" ","") + freq = {} + for char in s: + if char in freq: + freq[char] += 1 + else: + freq[char]=1 + sorted_chars = sorted(freq.keys()) + for char in sorted_chars: + print(f"{char}-> {freq[char]}") +str=input("String is:") +frequency(str) From a4672b02b0c6e0add82789dc4477b27c8866c3da Mon Sep 17 00:00:00 2001 From: Anweshaadas <146619748+Anweshaadas@users.noreply.github.com> Date: Sat, 29 Jun 2024 00:15:46 +0530 Subject: [PATCH 2/4] Add files via upload --- Task/anwesha das/que2.py | 13 +++++++++++++ Task/anwesha das/que4.py | 12 ++++++++++++ Task/anwesha das/que8.py | 22 ++++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 Task/anwesha das/que2.py create mode 100644 Task/anwesha das/que4.py create mode 100644 Task/anwesha das/que8.py diff --git a/Task/anwesha das/que2.py b/Task/anwesha das/que2.py new file mode 100644 index 0000000..264bf3e --- /dev/null +++ b/Task/anwesha das/que2.py @@ -0,0 +1,13 @@ +digits = [4,3,2,1] +digits_1st = [] +for i in digits: + digits_1st.append(str(i)) +a = ["r","o","b","o"] +digits_1st = "".join(digits_1st) +digits_1st = int(digits_1st) +print(digits_1st+1) +digits = list(str(digits_1st+1)) +result = [] +for digit in digits: + result.append(int(digit)) +print(result) \ No newline at end of file diff --git a/Task/anwesha das/que4.py b/Task/anwesha das/que4.py new file mode 100644 index 0000000..b67565b --- /dev/null +++ b/Task/anwesha das/que4.py @@ -0,0 +1,12 @@ +def count_frequency(arr): + frequency_dict = {} + for element in arr: + if element in frequency_dict: + frequency_dict[element] += 1 + else: + frequency_dict[element] = 1 + return frequency_dict + +arr = [1, 2, 3, 4, 2, 3, 1, 2, 4, 5, "robotics"] +frequency = count_frequency(arr) +print(frequency) \ No newline at end of file diff --git a/Task/anwesha das/que8.py b/Task/anwesha das/que8.py new file mode 100644 index 0000000..1a05ab2 --- /dev/null +++ b/Task/anwesha das/que8.py @@ -0,0 +1,22 @@ +rows=int(input("Enter the number of rows in the matrix: ")) +columns=int(input("Enter the number of columns in the matrix: ")) +matrix=[] +for i in range(rows): + row=[] + for j in range(columns): + + element=int(input("Enter the element: ")) + row.append(element) + matrix.append(row) +print("\nOriginal Matrix: \n") +for i in range(rows): + for j in range(columns): + print(matrix[i][j], end=" ") + print() + +Tmatrix=[[matrix[j][i] for j in range(rows)] for i in range(columns)] +print("\nTransposed Matrix:") +for i in range(columns): + for j in range(rows): + print(Tmatrix[i][j], end=" ") + print() \ No newline at end of file From 60970c8965adc5bf42486cd60cc46dc54a96a609 Mon Sep 17 00:00:00 2001 From: Anweshaadas <146619748+Anweshaadas@users.noreply.github.com> Date: Sat, 29 Jun 2024 00:17:36 +0530 Subject: [PATCH 3/4] Add files via upload --- Task/anwesha das/que6.py | 35 +++++++++++++++++++++++++++++++++++ Task/anwesha das/que9.py | 21 +++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 Task/anwesha das/que6.py create mode 100644 Task/anwesha das/que9.py diff --git a/Task/anwesha das/que6.py b/Task/anwesha das/que6.py new file mode 100644 index 0000000..dd02592 --- /dev/null +++ b/Task/anwesha das/que6.py @@ -0,0 +1,35 @@ + +mylist= [] +length =input('the number of elements u wanna enter') +length = int(length) +l=length +l1 = length +while length>0: + element =input('enetr the element') + mylist.append(element) + length = length-1 +print(mylist) +k='' +c='' +my_list=[] +my_list = mylist.copy() + +dict={} +while l>0: + k=mylist[l-1] + c=my_list.count(k) + mylist.remove(k) + if k in mylist: + l=l-1 + continue + print(k,c) + print(' ') + dict[k] = c + l=l-1 + +print(dict) + + + + + diff --git a/Task/anwesha das/que9.py b/Task/anwesha das/que9.py new file mode 100644 index 0000000..c32a1cb --- /dev/null +++ b/Task/anwesha das/que9.py @@ -0,0 +1,21 @@ +import pandas as pd +data = pd.read_csv("Iris.csv") +data.head() + +data.sample(10) + +data.columns + +#The first one is the number of rows and +# the other one is the number of columns. +data.shape + +print(data) + +sum_data = data["SepalLengthCm"].sum() +print("Sum:",sum_data) + +min_data=data["SepalLengthCm"].min() +max_data=data["SepalLengthCm"].max() + +print("Minimum:",min_data, "\nMaximum:", max_data) \ No newline at end of file From dbedc1ade6c58aa5dd287da9e41648ae4272a0ed Mon Sep 17 00:00:00 2001 From: Anweshaadas <146619748+Anweshaadas@users.noreply.github.com> Date: Sat, 29 Jun 2024 00:20:23 +0530 Subject: [PATCH 4/4] Add files via upload --- Task/anwesha das/que10.py | 22 ++++++++++++++++++++++ Task/anwesha das/que3.py | 24 ++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 Task/anwesha das/que10.py create mode 100644 Task/anwesha das/que3.py diff --git a/Task/anwesha das/que10.py b/Task/anwesha das/que10.py new file mode 100644 index 0000000..1a05ab2 --- /dev/null +++ b/Task/anwesha das/que10.py @@ -0,0 +1,22 @@ +rows=int(input("Enter the number of rows in the matrix: ")) +columns=int(input("Enter the number of columns in the matrix: ")) +matrix=[] +for i in range(rows): + row=[] + for j in range(columns): + + element=int(input("Enter the element: ")) + row.append(element) + matrix.append(row) +print("\nOriginal Matrix: \n") +for i in range(rows): + for j in range(columns): + print(matrix[i][j], end=" ") + print() + +Tmatrix=[[matrix[j][i] for j in range(rows)] for i in range(columns)] +print("\nTransposed Matrix:") +for i in range(columns): + for j in range(rows): + print(Tmatrix[i][j], end=" ") + print() \ No newline at end of file diff --git a/Task/anwesha das/que3.py b/Task/anwesha das/que3.py new file mode 100644 index 0000000..f197402 --- /dev/null +++ b/Task/anwesha das/que3.py @@ -0,0 +1,24 @@ +def is_prime(n): + if n <= 3: + return n > 1 + if n % 2 == 0 or n % 3 == 0: + return False + i = 5 + while i * i <= n: + if n % i == 0 or n % (i + 2) == 0: + return False + i += 6 + return True + +def difference(A): + primes = [num for num in A if is_prime(num)] + + if not primes: + return "No prime numbers present" + + return max(primes) - min(primes) + +A = [1, 2, 3, 4, 5] +print(difference(A)) + +