diff --git a/Task/1.py b/Task/1.py new file mode 100644 index 0000000..17a5db7 --- /dev/null +++ b/Task/1.py @@ -0,0 +1,7 @@ +st = str(input("Enter the first string :")) +nd = str(input("Enter the second string :")) + +if len(st) == len(nd): + print(sorted(st) == sorted(nd)) +else: + print("False") \ No newline at end of file diff --git a/Task/10.py b/Task/10.py new file mode 100644 index 0000000..c01b40a --- /dev/null +++ b/Task/10.py @@ -0,0 +1,20 @@ +r = int(input("Enter the number of Rows of the matrix: ")) +c = int(input("Enter the number of Columns of the matrix: ")) + +m1 = [[0]*c for _ in range(r)] +m2 = [[0]*r for _ in range(c)] + +print("Enter the Elements of the matrix below:\n") +for i in range(r): + for j in range(c): + m1[i][j] = int(input("Enter the Element " + str(i) + ", " + str(j) + " : ")) + +for i in range(r): + for j in range(c): + m2[j][i] = m1[i][j] + +print("The Transpose of the matrix is :\n") +for i in range(c): + for j in range(r): + print(m2[i][j], end=" ") + print("\n") \ No newline at end of file diff --git a/Task/3.py b/Task/3.py new file mode 100644 index 0000000..055f489 --- /dev/null +++ b/Task/3.py @@ -0,0 +1,12 @@ +digits = [] +l = int(input("Enter the number of digits : ")) +for i in range(0, l): + ele = int(input("Enter the digit :")) + digits.append(ele) + +if digits[-1] < 9: + digits[-1] += 1 + print(digits) +else: + digits[-1] = 0 + print([1] + digits) \ No newline at end of file diff --git a/Task/5.py b/Task/5.py new file mode 100644 index 0000000..976b219 --- /dev/null +++ b/Task/5.py @@ -0,0 +1,10 @@ +import cv2 + +O_img = cv2.imread('D:\Python Programming\Miles-Morales-Falling-Spider-Man-Across-the-Spider-Verse-4K-Wallpaper.jpg', cv2.IMREAD_GRAYSCALE) +canny = cv2.Canny(O_img, 90, 180) + +cv2.imshow('Original', O_img) +cv2.imshow('Canny', canny) + +cv2.waitKey(0) +cv2.destroyAllWindows() \ No newline at end of file diff --git a/Task/6.py b/Task/6.py new file mode 100644 index 0000000..b96bad1 --- /dev/null +++ b/Task/6.py @@ -0,0 +1,31 @@ +def is_prime(n): + if n <= 1: + return False + if n == 2: + return True + if n % 2 == 0: + return False + for i in range(3, int(n**0.5) + 1, 2): + if n % i == 0: + return False + return True + +N = int(input("Enter the number of points in the array : ")) +A = [] +for i in range(0, N): + ele = int(input("Enter the element : ")) + A.append(ele) + +sp = 0 +lp = 0 +for i in A: + if is_prime(i): + if i < sp: + sp = i + if i > lp: + lp = i + +if sp is None or lp is None: + print("1") +else: + print(abs(lp - sp)) \ No newline at end of file diff --git a/Task/7.py b/Task/7.py new file mode 100644 index 0000000..d25e4d7 --- /dev/null +++ b/Task/7.py @@ -0,0 +1,11 @@ +def min_prime(p): + for i in range(2, 1001): + if p % i == 0: + return i + return n + +n = int(input("Enter the number of products bought (n>=2) : ")) +print() +for j in range(0,n): + r = int(input("Enter the MRP of product " + str(j+1) + " : ")) + print("Rs " + str(r - min_prime(r))) \ No newline at end of file diff --git a/Task/8.py b/Task/8.py new file mode 100644 index 0000000..8a19f69 --- /dev/null +++ b/Task/8.py @@ -0,0 +1,14 @@ +lst = [] +n = int(input("Enter the length of the list: ")) +for i in range(0, n): + ele = int(input("Enter the element :")) + lst.append(ele) + +fdict = {} + +for j in lst: + if j not in fdict: + fdict[j] = 1 + else: + fdict[j] += 1 +print(fdict) \ No newline at end of file diff --git a/Task/Miles-Morales-Falling-Spider-Man-Across-the-Spider-Verse-4K-Wallpaper.jpg b/Task/Miles-Morales-Falling-Spider-Man-Across-the-Spider-Verse-4K-Wallpaper.jpg new file mode 100644 index 0000000..19e7cd1 Binary files /dev/null and b/Task/Miles-Morales-Falling-Spider-Man-Across-the-Spider-Verse-4K-Wallpaper.jpg differ diff --git a/Task/Swarup Mahakud/1.py b/Task/Swarup Mahakud/1.py new file mode 100644 index 0000000..17a5db7 --- /dev/null +++ b/Task/Swarup Mahakud/1.py @@ -0,0 +1,7 @@ +st = str(input("Enter the first string :")) +nd = str(input("Enter the second string :")) + +if len(st) == len(nd): + print(sorted(st) == sorted(nd)) +else: + print("False") \ No newline at end of file diff --git a/Task/Swarup Mahakud/10.py b/Task/Swarup Mahakud/10.py new file mode 100644 index 0000000..c01b40a --- /dev/null +++ b/Task/Swarup Mahakud/10.py @@ -0,0 +1,20 @@ +r = int(input("Enter the number of Rows of the matrix: ")) +c = int(input("Enter the number of Columns of the matrix: ")) + +m1 = [[0]*c for _ in range(r)] +m2 = [[0]*r for _ in range(c)] + +print("Enter the Elements of the matrix below:\n") +for i in range(r): + for j in range(c): + m1[i][j] = int(input("Enter the Element " + str(i) + ", " + str(j) + " : ")) + +for i in range(r): + for j in range(c): + m2[j][i] = m1[i][j] + +print("The Transpose of the matrix is :\n") +for i in range(c): + for j in range(r): + print(m2[i][j], end=" ") + print("\n") \ No newline at end of file diff --git a/Task/Swarup Mahakud/3.py b/Task/Swarup Mahakud/3.py new file mode 100644 index 0000000..055f489 --- /dev/null +++ b/Task/Swarup Mahakud/3.py @@ -0,0 +1,12 @@ +digits = [] +l = int(input("Enter the number of digits : ")) +for i in range(0, l): + ele = int(input("Enter the digit :")) + digits.append(ele) + +if digits[-1] < 9: + digits[-1] += 1 + print(digits) +else: + digits[-1] = 0 + print([1] + digits) \ No newline at end of file diff --git a/Task/Swarup Mahakud/5.py b/Task/Swarup Mahakud/5.py new file mode 100644 index 0000000..976b219 --- /dev/null +++ b/Task/Swarup Mahakud/5.py @@ -0,0 +1,10 @@ +import cv2 + +O_img = cv2.imread('D:\Python Programming\Miles-Morales-Falling-Spider-Man-Across-the-Spider-Verse-4K-Wallpaper.jpg', cv2.IMREAD_GRAYSCALE) +canny = cv2.Canny(O_img, 90, 180) + +cv2.imshow('Original', O_img) +cv2.imshow('Canny', canny) + +cv2.waitKey(0) +cv2.destroyAllWindows() \ No newline at end of file diff --git a/Task/Swarup Mahakud/6.py b/Task/Swarup Mahakud/6.py new file mode 100644 index 0000000..b96bad1 --- /dev/null +++ b/Task/Swarup Mahakud/6.py @@ -0,0 +1,31 @@ +def is_prime(n): + if n <= 1: + return False + if n == 2: + return True + if n % 2 == 0: + return False + for i in range(3, int(n**0.5) + 1, 2): + if n % i == 0: + return False + return True + +N = int(input("Enter the number of points in the array : ")) +A = [] +for i in range(0, N): + ele = int(input("Enter the element : ")) + A.append(ele) + +sp = 0 +lp = 0 +for i in A: + if is_prime(i): + if i < sp: + sp = i + if i > lp: + lp = i + +if sp is None or lp is None: + print("1") +else: + print(abs(lp - sp)) \ No newline at end of file diff --git a/Task/Swarup Mahakud/7.py b/Task/Swarup Mahakud/7.py new file mode 100644 index 0000000..d25e4d7 --- /dev/null +++ b/Task/Swarup Mahakud/7.py @@ -0,0 +1,11 @@ +def min_prime(p): + for i in range(2, 1001): + if p % i == 0: + return i + return n + +n = int(input("Enter the number of products bought (n>=2) : ")) +print() +for j in range(0,n): + r = int(input("Enter the MRP of product " + str(j+1) + " : ")) + print("Rs " + str(r - min_prime(r))) \ No newline at end of file diff --git a/Task/Swarup Mahakud/8.py b/Task/Swarup Mahakud/8.py new file mode 100644 index 0000000..8a19f69 --- /dev/null +++ b/Task/Swarup Mahakud/8.py @@ -0,0 +1,14 @@ +lst = [] +n = int(input("Enter the length of the list: ")) +for i in range(0, n): + ele = int(input("Enter the element :")) + lst.append(ele) + +fdict = {} + +for j in lst: + if j not in fdict: + fdict[j] = 1 + else: + fdict[j] += 1 +print(fdict) \ No newline at end of file diff --git a/Task/Swarup Mahakud/Miles-Morales-Falling-Spider-Man-Across-the-Spider-Verse-4K-Wallpaper.jpg b/Task/Swarup Mahakud/Miles-Morales-Falling-Spider-Man-Across-the-Spider-Verse-4K-Wallpaper.jpg new file mode 100644 index 0000000..19e7cd1 Binary files /dev/null and b/Task/Swarup Mahakud/Miles-Morales-Falling-Spider-Man-Across-the-Spider-Verse-4K-Wallpaper.jpg differ diff --git a/Task/iris.csv b/Task/iris.csv new file mode 100644 index 0000000..1b9d029 --- /dev/null +++ b/Task/iris.csv @@ -0,0 +1,151 @@ +"sepal.length","sepal.width","petal.length","petal.width","variety" +5.1,3.5,1.4,.2,"Setosa" +4.9,3,1.4,.2,"Setosa" +4.7,3.2,1.3,.2,"Setosa" +4.6,3.1,1.5,.2,"Setosa" +5,3.6,1.4,.2,"Setosa" +5.4,3.9,1.7,.4,"Setosa" +4.6,3.4,1.4,.3,"Setosa" +5,3.4,1.5,.2,"Setosa" +4.4,2.9,1.4,.2,"Setosa" +4.9,3.1,1.5,.1,"Setosa" +5.4,3.7,1.5,.2,"Setosa" +4.8,3.4,1.6,.2,"Setosa" +4.8,3,1.4,.1,"Setosa" +4.3,3,1.1,.1,"Setosa" +5.8,4,1.2,.2,"Setosa" +5.7,4.4,1.5,.4,"Setosa" +5.4,3.9,1.3,.4,"Setosa" +5.1,3.5,1.4,.3,"Setosa" +5.7,3.8,1.7,.3,"Setosa" +5.1,3.8,1.5,.3,"Setosa" +5.4,3.4,1.7,.2,"Setosa" +5.1,3.7,1.5,.4,"Setosa" +4.6,3.6,1,.2,"Setosa" +5.1,3.3,1.7,.5,"Setosa" +4.8,3.4,1.9,.2,"Setosa" +5,3,1.6,.2,"Setosa" +5,3.4,1.6,.4,"Setosa" +5.2,3.5,1.5,.2,"Setosa" +5.2,3.4,1.4,.2,"Setosa" +4.7,3.2,1.6,.2,"Setosa" +4.8,3.1,1.6,.2,"Setosa" +5.4,3.4,1.5,.4,"Setosa" +5.2,4.1,1.5,.1,"Setosa" +5.5,4.2,1.4,.2,"Setosa" +4.9,3.1,1.5,.2,"Setosa" +5,3.2,1.2,.2,"Setosa" +5.5,3.5,1.3,.2,"Setosa" +4.9,3.6,1.4,.1,"Setosa" +4.4,3,1.3,.2,"Setosa" +5.1,3.4,1.5,.2,"Setosa" +5,3.5,1.3,.3,"Setosa" +4.5,2.3,1.3,.3,"Setosa" +4.4,3.2,1.3,.2,"Setosa" +5,3.5,1.6,.6,"Setosa" +5.1,3.8,1.9,.4,"Setosa" +4.8,3,1.4,.3,"Setosa" +5.1,3.8,1.6,.2,"Setosa" +4.6,3.2,1.4,.2,"Setosa" +5.3,3.7,1.5,.2,"Setosa" +5,3.3,1.4,.2,"Setosa" +7,3.2,4.7,1.4,"Versicolor" +6.4,3.2,4.5,1.5,"Versicolor" +6.9,3.1,4.9,1.5,"Versicolor" +5.5,2.3,4,1.3,"Versicolor" +6.5,2.8,4.6,1.5,"Versicolor" +5.7,2.8,4.5,1.3,"Versicolor" +6.3,3.3,4.7,1.6,"Versicolor" +4.9,2.4,3.3,1,"Versicolor" +6.6,2.9,4.6,1.3,"Versicolor" +5.2,2.7,3.9,1.4,"Versicolor" +5,2,3.5,1,"Versicolor" +5.9,3,4.2,1.5,"Versicolor" +6,2.2,4,1,"Versicolor" +6.1,2.9,4.7,1.4,"Versicolor" +5.6,2.9,3.6,1.3,"Versicolor" +6.7,3.1,4.4,1.4,"Versicolor" +5.6,3,4.5,1.5,"Versicolor" +5.8,2.7,4.1,1,"Versicolor" +6.2,2.2,4.5,1.5,"Versicolor" +5.6,2.5,3.9,1.1,"Versicolor" +5.9,3.2,4.8,1.8,"Versicolor" +6.1,2.8,4,1.3,"Versicolor" +6.3,2.5,4.9,1.5,"Versicolor" +6.1,2.8,4.7,1.2,"Versicolor" +6.4,2.9,4.3,1.3,"Versicolor" +6.6,3,4.4,1.4,"Versicolor" +6.8,2.8,4.8,1.4,"Versicolor" +6.7,3,5,1.7,"Versicolor" +6,2.9,4.5,1.5,"Versicolor" +5.7,2.6,3.5,1,"Versicolor" +5.5,2.4,3.8,1.1,"Versicolor" +5.5,2.4,3.7,1,"Versicolor" +5.8,2.7,3.9,1.2,"Versicolor" +6,2.7,5.1,1.6,"Versicolor" +5.4,3,4.5,1.5,"Versicolor" +6,3.4,4.5,1.6,"Versicolor" +6.7,3.1,4.7,1.5,"Versicolor" +6.3,2.3,4.4,1.3,"Versicolor" +5.6,3,4.1,1.3,"Versicolor" +5.5,2.5,4,1.3,"Versicolor" +5.5,2.6,4.4,1.2,"Versicolor" +6.1,3,4.6,1.4,"Versicolor" +5.8,2.6,4,1.2,"Versicolor" +5,2.3,3.3,1,"Versicolor" +5.6,2.7,4.2,1.3,"Versicolor" +5.7,3,4.2,1.2,"Versicolor" +5.7,2.9,4.2,1.3,"Versicolor" +6.2,2.9,4.3,1.3,"Versicolor" +5.1,2.5,3,1.1,"Versicolor" +5.7,2.8,4.1,1.3,"Versicolor" +6.3,3.3,6,2.5,"Virginica" +5.8,2.7,5.1,1.9,"Virginica" +7.1,3,5.9,2.1,"Virginica" +6.3,2.9,5.6,1.8,"Virginica" +6.5,3,5.8,2.2,"Virginica" +7.6,3,6.6,2.1,"Virginica" +4.9,2.5,4.5,1.7,"Virginica" +7.3,2.9,6.3,1.8,"Virginica" +6.7,2.5,5.8,1.8,"Virginica" +7.2,3.6,6.1,2.5,"Virginica" +6.5,3.2,5.1,2,"Virginica" +6.4,2.7,5.3,1.9,"Virginica" +6.8,3,5.5,2.1,"Virginica" +5.7,2.5,5,2,"Virginica" +5.8,2.8,5.1,2.4,"Virginica" +6.4,3.2,5.3,2.3,"Virginica" +6.5,3,5.5,1.8,"Virginica" +7.7,3.8,6.7,2.2,"Virginica" +7.7,2.6,6.9,2.3,"Virginica" +6,2.2,5,1.5,"Virginica" +6.9,3.2,5.7,2.3,"Virginica" +5.6,2.8,4.9,2,"Virginica" +7.7,2.8,6.7,2,"Virginica" +6.3,2.7,4.9,1.8,"Virginica" +6.7,3.3,5.7,2.1,"Virginica" +7.2,3.2,6,1.8,"Virginica" +6.2,2.8,4.8,1.8,"Virginica" +6.1,3,4.9,1.8,"Virginica" +6.4,2.8,5.6,2.1,"Virginica" +7.2,3,5.8,1.6,"Virginica" +7.4,2.8,6.1,1.9,"Virginica" +7.9,3.8,6.4,2,"Virginica" +6.4,2.8,5.6,2.2,"Virginica" +6.3,2.8,5.1,1.5,"Virginica" +6.1,2.6,5.6,1.4,"Virginica" +7.7,3,6.1,2.3,"Virginica" +6.3,3.4,5.6,2.4,"Virginica" +6.4,3.1,5.5,1.8,"Virginica" +6,3,4.8,1.8,"Virginica" +6.9,3.1,5.4,2.1,"Virginica" +6.7,3.1,5.6,2.4,"Virginica" +6.9,3.1,5.1,2.3,"Virginica" +5.8,2.7,5.1,1.9,"Virginica" +6.8,3.2,5.9,2.3,"Virginica" +6.7,3.3,5.7,2.5,"Virginica" +6.7,3,5.2,2.3,"Virginica" +6.3,2.5,5,1.9,"Virginica" +6.5,3,5.2,2,"Virginica" +6.2,3.4,5.4,2.3,"Virginica" +5.9,3,5.1,1.8,"Virginica" \ No newline at end of file