From 863fd8ea395e83dfb9a91c5846aae8f67db4439b Mon Sep 17 00:00:00 2001 From: Anweshaadas <146619748+Anweshaadas@users.noreply.github.com> Date: Sun, 16 Jun 2024 18:04:31 +0530 Subject: [PATCH 1/3] anwesha das --- Task/anwesha das | 1 + 1 file changed, 1 insertion(+) create mode 100644 Task/anwesha das diff --git a/Task/anwesha das b/Task/anwesha das new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Task/anwesha das @@ -0,0 +1 @@ + From b090ecf4ab982944b3b075e727f7ced8e77ef0c3 Mon Sep 17 00:00:00 2001 From: Anweshaadas <146619748+Anweshaadas@users.noreply.github.com> Date: Sun, 16 Jun 2024 18:10:20 +0530 Subject: [PATCH 2/3] Add files via upload --- que1.py | 13 +++++++++++++ que10.py | 21 +++++++++++++++++++++ que2.py | 13 +++++++++++++ que3.py | 24 ++++++++++++++++++++++++ que4.py | 12 ++++++++++++ que6.py | 35 +++++++++++++++++++++++++++++++++++ que8.py | 22 ++++++++++++++++++++++ que9.py | 21 +++++++++++++++++++++ 8 files changed, 161 insertions(+) create mode 100644 que1.py create mode 100644 que10.py create mode 100644 que2.py create mode 100644 que3.py create mode 100644 que4.py create mode 100644 que6.py create mode 100644 que8.py create mode 100644 que9.py diff --git a/que1.py b/que1.py new file mode 100644 index 0000000..1012b04 --- /dev/null +++ b/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) \ No newline at end of file diff --git a/que10.py b/que10.py new file mode 100644 index 0000000..c32a1cb --- /dev/null +++ b/que10.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 diff --git a/que2.py b/que2.py new file mode 100644 index 0000000..264bf3e --- /dev/null +++ b/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/que3.py b/que3.py new file mode 100644 index 0000000..f197402 --- /dev/null +++ b/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)) + + diff --git a/que4.py b/que4.py new file mode 100644 index 0000000..b67565b --- /dev/null +++ b/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/que6.py b/que6.py new file mode 100644 index 0000000..dd02592 --- /dev/null +++ b/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/que8.py b/que8.py new file mode 100644 index 0000000..1a05ab2 --- /dev/null +++ b/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 diff --git a/que9.py b/que9.py new file mode 100644 index 0000000..c32a1cb --- /dev/null +++ b/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 57b99ae3e66a263bb268996a4e66633eb7cd262d Mon Sep 17 00:00:00 2001 From: Anweshaadas <146619748+Anweshaadas@users.noreply.github.com> Date: Sun, 16 Jun 2024 18:30:03 +0530 Subject: [PATCH 3/3] Update anwesha das --- Task/anwesha das | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/anwesha das b/Task/anwesha das index 8b13789..9b040f5 100644 --- a/Task/anwesha das +++ b/Task/anwesha das @@ -1 +1 @@ - +anwesha das