From 8292aec6a7a5f71ded2b3dbcc51e2c3c936e3b78 Mon Sep 17 00:00:00 2001 From: naksh29 <75304583+naksh29@users.noreply.github.com> Date: Sun, 24 Jan 2021 16:23:15 +0530 Subject: [PATCH 1/7] Update work.py complete assignment and done equation solver differently --- Week1/work.py | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/Week1/work.py b/Week1/work.py index 0099552..47a2ae1 100644 --- a/Week1/work.py +++ b/Week1/work.py @@ -12,7 +12,7 @@ def demo(x): ''' ## Code Here - return None + return x*x def is_palindrome(string): ''' @@ -26,6 +26,16 @@ def is_palindrome(string): ## Code Here return None + n=len(str) + bool=0 + str=str.lower() + for i in range(0,n): + if(str[i]==str[n-1-i]): + bool="True" + else: + bool="False" + return bool + def sqrt_of_numbers(num): ''' @@ -38,6 +48,11 @@ def sqrt_of_numbers(num): ## Code Here return None + num=abs(num) + sqrt=num ** 0.5 + + + return float(sqrt) def Maximum(arr): ''' @@ -51,6 +66,13 @@ def Maximum(arr): ## Code Here return None + arr.sort() + + Max1=arr[-1] + Max2=arr[-2] + + + return Max1,Max2 def even_sort(arr): ''' @@ -68,6 +90,27 @@ def even_sort(arr): ## Code Here return None + arr1=[] + arr2=[] + arr3=[] + + + arr.sort() + for i in arr: + + + + if(arr[i]%2==0): + arr1.append(arr[i]) + else: + arr2.append(arr[i]) + + + arr3=arr1+arr2 + + + + return arr3 def eqn_solver(A, B, C): @@ -89,3 +132,21 @@ def eqn_solver(A, B, C): ## Code Here return None + lst=[] + + lst1=[] + + lst2=[] + lst=[int(item) for item in input("A=").split()] + lst1=[int(item) for item in input("B=").split()] + lst2=[int(item) for item in input("C=").split()] + + + + x=float((lst2[0]*lst1[1])-(lst2[1]*lst1[0]))/((lst1[1]*lst[0])-(lst[1]*lst1[0])) + y=float((lst2[0]*lst[1])-(lst2[1]*lst[0]))/((lst1[0]*lst[1])-(lst[0]*lst1[1])) + + + + + return float(x),float(y) From 8823720fd81c942cbe2893f88f123525fb987883 Mon Sep 17 00:00:00 2001 From: naksh29 <75304583+naksh29@users.noreply.github.com> Date: Sun, 24 Jan 2021 16:54:11 +0530 Subject: [PATCH 2/7] Update work.py complete all --- Week1/work.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Week1/work.py b/Week1/work.py index 47a2ae1..77eaf25 100644 --- a/Week1/work.py +++ b/Week1/work.py @@ -26,11 +26,11 @@ def is_palindrome(string): ## Code Here return None - n=len(str) + n=len(string) bool=0 - str=str.lower() + string=string.lower() for i in range(0,n): - if(str[i]==str[n-1-i]): + if(string[i]==string[n-1-i]): bool="True" else: bool="False" @@ -49,10 +49,10 @@ def sqrt_of_numbers(num): ## Code Here return None num=abs(num) - sqrt=num ** 0.5 + num=num ** 0.5 - return float(sqrt) + return float(num) def Maximum(arr): ''' @@ -68,11 +68,10 @@ def Maximum(arr): return None arr.sort() - Max1=arr[-1] - Max2=arr[-2] + - return Max1,Max2 + return Max1,Max2(arr[-1],arr[-2]) def even_sort(arr): ''' @@ -101,9 +100,9 @@ def even_sort(arr): if(arr[i]%2==0): - arr1.append(arr[i]) + arr1=arr[i] else: - arr2.append(arr[i]) + arr2=arr[i] arr3=arr1+arr2 From 04df80470f3c2382b40365e67aa95b4bb48ec6dc Mon Sep 17 00:00:00 2001 From: naksh29 <75304583+naksh29@users.noreply.github.com> Date: Sun, 24 Jan 2021 17:02:25 +0530 Subject: [PATCH 3/7] Update work.py --- Week1/work.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Week1/work.py b/Week1/work.py index 77eaf25..041cff3 100644 --- a/Week1/work.py +++ b/Week1/work.py @@ -24,8 +24,7 @@ def is_palindrome(string): flag (bool) ''' - ## Code Here - return None + n=len(string) bool=0 string=string.lower() @@ -46,8 +45,7 @@ def sqrt_of_numbers(num): sqroot (float) ''' - ## Code Here - return None + num=abs(num) num=num ** 0.5 @@ -64,8 +62,7 @@ def Maximum(arr): Max1, Max2 (int, int) ''' - ## Code Here - return None + arr.sort() @@ -87,8 +84,7 @@ def even_sort(arr): ## This is any even number is smaller than any odd number ''' - ## Code Here - return None + arr1=[] arr2=[] arr3=[] @@ -129,8 +125,8 @@ def eqn_solver(A, B, C): x, y (float, float) ''' - ## Code Here - return None + + lst=[] lst1=[] From 41831ffc863636c703960a27df5c0a2f0f5ef239 Mon Sep 17 00:00:00 2001 From: naksh29 <75304583+naksh29@users.noreply.github.com> Date: Sun, 24 Jan 2021 17:26:10 +0530 Subject: [PATCH 4/7] Update work.py --- Week1/work.py | 48 +++++++++++++++++------------------------------- 1 file changed, 17 insertions(+), 31 deletions(-) diff --git a/Week1/work.py b/Week1/work.py index 041cff3..59e1852 100644 --- a/Week1/work.py +++ b/Week1/work.py @@ -25,16 +25,15 @@ def is_palindrome(string): ''' - n=len(string) - bool=0 - string=string.lower() - for i in range(0,n): - if(string[i]==string[n-1-i]): - bool="True" + n=len(str) + flag=0 + str=str.lower() + for i in range(0,n/2): + if(str[i]==str[n-1-i]): + flag="True" else: - bool="False" - return bool - + flag="False" + return flag def sqrt_of_numbers(num): ''' @@ -68,7 +67,7 @@ def Maximum(arr): - return Max1,Max2(arr[-1],arr[-2]) + return arr[-1],arr[-2] def even_sort(arr): ''' @@ -87,7 +86,7 @@ def even_sort(arr): arr1=[] arr2=[] - arr3=[] + sort_arr=[] arr.sort() @@ -96,16 +95,17 @@ def even_sort(arr): if(arr[i]%2==0): - arr1=arr[i] + arr1.append(arr[i]) else: - arr2=arr[i] + arr2.append(arr[i]) + - arr3=arr1+arr2 + sort_arr=arr1+arr2 - return arr3 + return sort_arr def eqn_solver(A, B, C): @@ -125,23 +125,9 @@ def eqn_solver(A, B, C): x, y (float, float) ''' - - - lst=[] - - lst1=[] - - lst2=[] - lst=[int(item) for item in input("A=").split()] - lst1=[int(item) for item in input("B=").split()] - lst2=[int(item) for item in input("C=").split()] - - - - x=float((lst2[0]*lst1[1])-(lst2[1]*lst1[0]))/((lst1[1]*lst[0])-(lst[1]*lst1[0])) - y=float((lst2[0]*lst[1])-(lst2[1]*lst[0]))/((lst1[0]*lst[1])-(lst[0]*lst1[1])) - + x=float((C[0]*B[1])-(C[1]*B[0]))/((B[1]*A[0])-(A[1]*B[0])) + y=float((C[0]*A[1])-(C[1]*A[0]))/((B[0]*A[1])-(A[0]*B[1])) return float(x),float(y) From c6af69a25dd61346b011a1a6f31f1d955a060fe7 Mon Sep 17 00:00:00 2001 From: naksh29 <75304583+naksh29@users.noreply.github.com> Date: Sun, 24 Jan 2021 17:42:07 +0530 Subject: [PATCH 5/7] Update work.py complete all --- Week1/work.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Week1/work.py b/Week1/work.py index 59e1852..edb2c3a 100644 --- a/Week1/work.py +++ b/Week1/work.py @@ -28,11 +28,11 @@ def is_palindrome(string): n=len(str) flag=0 str=str.lower() - for i in range(0,n/2): + for i in range(0,n): if(str[i]==str[n-1-i]): - flag="True" + flag=True else: - flag="False" + flag=False return flag def sqrt_of_numbers(num): @@ -87,15 +87,13 @@ def even_sort(arr): arr1=[] arr2=[] sort_arr=[] - + n=len(arr) arr.sort() - for i in arr: + for i in range(0,n): - - - if(arr[i]%2==0): - arr1.append(arr[i]) + if(arr[i]%2==0): + arr1.append(arr[i]) else: arr2.append(arr[i]) From 07c66918cd37309be69d412fabe6c8c94d98e159 Mon Sep 17 00:00:00 2001 From: naksh29 <75304583+naksh29@users.noreply.github.com> Date: Sun, 24 Jan 2021 17:46:10 +0530 Subject: [PATCH 6/7] Update work.py --- Week1/work.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Week1/work.py b/Week1/work.py index edb2c3a..05ccf8f 100644 --- a/Week1/work.py +++ b/Week1/work.py @@ -87,15 +87,15 @@ def even_sort(arr): arr1=[] arr2=[] sort_arr=[] - n=len(arr) + n=len(arr) arr.sort() for i in range(0,n): if(arr[i]%2==0): arr1.append(arr[i]) - else: - arr2.append(arr[i]) + else: + arr2.append(arr[i]) From 4effb47f22fb84fb16ba012ac3e2ed6cb4256161 Mon Sep 17 00:00:00 2001 From: naksh29 <75304583+naksh29@users.noreply.github.com> Date: Sun, 24 Jan 2021 19:07:56 +0530 Subject: [PATCH 7/7] Update work.py --- Week1/work.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Week1/work.py b/Week1/work.py index 05ccf8f..740cfc3 100644 --- a/Week1/work.py +++ b/Week1/work.py @@ -25,11 +25,11 @@ def is_palindrome(string): ''' - n=len(str) - flag=0 - str=str.lower() + n=len(string) + flag=False + string=string.lower() for i in range(0,n): - if(str[i]==str[n-1-i]): + if(string[i]==string[n-1-i]): flag=True else: flag=False