From 11178540905f03b2ed2a1feb12b1fe418aabe378 Mon Sep 17 00:00:00 2001 From: Maria <46182261+Maria16pca111@users.noreply.github.com> Date: Sun, 7 Apr 2019 21:51:42 +0530 Subject: [PATCH 1/2] 42 out of 50 still working on it --- UnsortedArray/Attendance_Registry.py | 22 ++++++++++++++++ UnsortedArray/Attendance_Registry_re1.py | 12 +++++++++ .../FindValue_After_R_Rotations_Left.py | 15 +++++++++++ UnsortedArray/Find_Value_After_R_Rotations.py | 16 ++++++++++++ UnsortedArray/Index_After_Rotations_Left.py | 14 +++++++++++ UnsortedArray/Index_After_Two_Rotations.py | 14 +++++++++++ UnsortedArray/SubsetA_a_adds_gives_X.py | 15 +++++++++++ UnsortedArray/Two_arrays_Same.py | 13 ++++++++++ UnsortedArray/array_conatain_perfectsquare.py | 13 ++++++++++ UnsortedArray/array_contains_x.py | 14 +++++++++++ UnsortedArray/array_duplicate_removed.py | 7 ++++++ UnsortedArray/array_exe.py | 9 +++++++ UnsortedArray/array_input_return_output.py | 7 ++++++ UnsortedArray/array_largest.py | 10 ++++++++ UnsortedArray/array_morethan_once.py | 12 +++++++++ UnsortedArray/array_return_evenno.py | 11 ++++++++ UnsortedArray/array_return_oddno.py | 7 ++++++ UnsortedArray/array_return_primeno.py | 25 +++++++++++++++++++ UnsortedArray/array_rev_order.py | 17 +++++++++++++ UnsortedArray/array_reverse_order.py | 10 ++++++++ UnsortedArray/array_smallest.py | 11 ++++++++ UnsortedArray/array_subset_indices_adds_x.py | 20 +++++++++++++++ UnsortedArray/counttime_apperars_array.py | 12 +++++++++ UnsortedArray/countvalues_givenrange.py | 13 ++++++++++ UnsortedArray/findX.py | 9 +++++++ UnsortedArray/indices_which_adds_x.py | 22 ++++++++++++++++ UnsortedArray/kth_largest_array.py | 8 ++++++ UnsortedArray/kthsmallest_Array.py | 9 +++++++ UnsortedArray/leftby1position.py | 9 +++++++ UnsortedArray/loc_of_array_value.py | 12 +++++++++ UnsortedArray/meanarray.py | 11 ++++++++ UnsortedArray/mode_array.py | 20 +++++++++++++++ UnsortedArray/number_times_largest_found.py | 19 ++++++++++++++ UnsortedArray/number_times_x.py | 14 +++++++++++ UnsortedArray/numer_Smallest_array_found.py | 15 +++++++++++ UnsortedArray/palindrome.py | 13 ++++++++++ UnsortedArray/rightby1position.py | 10 ++++++++ UnsortedArray/secondlargest_smallest_array.py | 15 +++++++++++ .../subset_adds_x_values_variations.py | 14 +++++++++++ UnsortedArray/sumelementsa.py | 9 +++++++ UnsortedArray/tworightbyposition.py | 14 +++++++++++ UnsortedArray/values_count_lessthan.py | 12 +++++++++ 42 files changed, 554 insertions(+) create mode 100644 UnsortedArray/Attendance_Registry.py create mode 100644 UnsortedArray/Attendance_Registry_re1.py create mode 100644 UnsortedArray/FindValue_After_R_Rotations_Left.py create mode 100644 UnsortedArray/Find_Value_After_R_Rotations.py create mode 100644 UnsortedArray/Index_After_Rotations_Left.py create mode 100644 UnsortedArray/Index_After_Two_Rotations.py create mode 100644 UnsortedArray/SubsetA_a_adds_gives_X.py create mode 100644 UnsortedArray/Two_arrays_Same.py create mode 100644 UnsortedArray/array_conatain_perfectsquare.py create mode 100644 UnsortedArray/array_contains_x.py create mode 100644 UnsortedArray/array_duplicate_removed.py create mode 100644 UnsortedArray/array_exe.py create mode 100644 UnsortedArray/array_input_return_output.py create mode 100644 UnsortedArray/array_largest.py create mode 100644 UnsortedArray/array_morethan_once.py create mode 100644 UnsortedArray/array_return_evenno.py create mode 100644 UnsortedArray/array_return_oddno.py create mode 100644 UnsortedArray/array_return_primeno.py create mode 100644 UnsortedArray/array_rev_order.py create mode 100644 UnsortedArray/array_reverse_order.py create mode 100644 UnsortedArray/array_smallest.py create mode 100644 UnsortedArray/array_subset_indices_adds_x.py create mode 100644 UnsortedArray/counttime_apperars_array.py create mode 100644 UnsortedArray/countvalues_givenrange.py create mode 100644 UnsortedArray/findX.py create mode 100644 UnsortedArray/indices_which_adds_x.py create mode 100644 UnsortedArray/kth_largest_array.py create mode 100644 UnsortedArray/kthsmallest_Array.py create mode 100644 UnsortedArray/leftby1position.py create mode 100644 UnsortedArray/loc_of_array_value.py create mode 100644 UnsortedArray/meanarray.py create mode 100644 UnsortedArray/mode_array.py create mode 100644 UnsortedArray/number_times_largest_found.py create mode 100644 UnsortedArray/number_times_x.py create mode 100644 UnsortedArray/numer_Smallest_array_found.py create mode 100644 UnsortedArray/palindrome.py create mode 100644 UnsortedArray/rightby1position.py create mode 100644 UnsortedArray/secondlargest_smallest_array.py create mode 100644 UnsortedArray/subset_adds_x_values_variations.py create mode 100644 UnsortedArray/sumelementsa.py create mode 100644 UnsortedArray/tworightbyposition.py create mode 100644 UnsortedArray/values_count_lessthan.py diff --git a/UnsortedArray/Attendance_Registry.py b/UnsortedArray/Attendance_Registry.py new file mode 100644 index 0000000..ce80396 --- /dev/null +++ b/UnsortedArray/Attendance_Registry.py @@ -0,0 +1,22 @@ +def Attendance_Registry(Entry): + Count=0 + CountMax=0 + for x in range(0,10): + if not (x==Entry): + Entry.insert(0,x) + print'Welcome' + Count+=1 + print(Entry) + for y in Entry: + for z in Entry: + if(y==z): + Updated_Entry=Entry.remove(z) + print'Bye! See you Again' + CountMax+=1 + print(Updated_Entry) + print(Entry) + print Count,CountMax + +Entry=[20] +Attendance_Registry(Entry) + \ No newline at end of file diff --git a/UnsortedArray/Attendance_Registry_re1.py b/UnsortedArray/Attendance_Registry_re1.py new file mode 100644 index 0000000..b6c2c63 --- /dev/null +++ b/UnsortedArray/Attendance_Registry_re1.py @@ -0,0 +1,12 @@ +n=input('number') +data=[1,2,3,4,5] +for x in data: + if not(n==x): + data.append(n) + print('yes! you are Inside') + + else: + data.pop(n) + print('You are out') +print(data) + \ No newline at end of file diff --git a/UnsortedArray/FindValue_After_R_Rotations_Left.py b/UnsortedArray/FindValue_After_R_Rotations_Left.py new file mode 100644 index 0000000..5289a36 --- /dev/null +++ b/UnsortedArray/FindValue_After_R_Rotations_Left.py @@ -0,0 +1,15 @@ +# find the value after the r rotations left + +def Value_After_R_Rotations_Left(a,k): + count=0 + while(count!=k): + x=a.pop(-1) + count+=1 + a.insert(0,x) + count+1 + return a,a[Index] + +a=[1,2,3,4,5,6,7,8,9] +k=5 +Index=3 +print(Value_After_R_Rotations_Left(a,k)) \ No newline at end of file diff --git a/UnsortedArray/Find_Value_After_R_Rotations.py b/UnsortedArray/Find_Value_After_R_Rotations.py new file mode 100644 index 0000000..8f99c2b --- /dev/null +++ b/UnsortedArray/Find_Value_After_R_Rotations.py @@ -0,0 +1,16 @@ +# Find the value which will be in index and get after R Rotations to the Right + +def Index_R_Rotations_Find_I(a,I,R): + rotation=1 + while(rotationInit_Large): + Init_Large=x + return Init_Large +arr=[11,20,3,4,0] +print(Largest_Array(arr)) diff --git a/UnsortedArray/array_morethan_once.py b/UnsortedArray/array_morethan_once.py new file mode 100644 index 0000000..51e186a --- /dev/null +++ b/UnsortedArray/array_morethan_once.py @@ -0,0 +1,12 @@ +#array contains more than once +def more_than_once(arr,x): + flag=False + count=0 + for i in arr: + if i==x: + count+=1 + if count>1: + flag=True + return flag +arr=[5,2,7,3,1] +print(more_than_once(arr,2)) \ No newline at end of file diff --git a/UnsortedArray/array_return_evenno.py b/UnsortedArray/array_return_evenno.py new file mode 100644 index 0000000..2cc6ca9 --- /dev/null +++ b/UnsortedArray/array_return_evenno.py @@ -0,0 +1,11 @@ +#return the even no in an array of elements + +def evenno_array(arr): + flag=False + for x in arr: + if(x%2==0): + flag=True + print(x) + return flag +arr=[1,3,4,5,5,7,2,10] +print(evenno_array(arr)) \ No newline at end of file diff --git a/UnsortedArray/array_return_oddno.py b/UnsortedArray/array_return_oddno.py new file mode 100644 index 0000000..f2ab515 --- /dev/null +++ b/UnsortedArray/array_return_oddno.py @@ -0,0 +1,7 @@ +#display the odd numbers in an array +def oddno_array(arr): + for x in arr: + if not(x%2==0): + print(x) +arr=[1,3,4,5,5,7,2,10] +print(oddno_array(arr)) \ No newline at end of file diff --git a/UnsortedArray/array_return_primeno.py b/UnsortedArray/array_return_primeno.py new file mode 100644 index 0000000..02dbfbe --- /dev/null +++ b/UnsortedArray/array_return_primeno.py @@ -0,0 +1,25 @@ +#return the no of primeno in an array +import math +def IsPrime(n): + flag=True + for i in range(2,n**1/2): + if(n%i==0): + flag=False + break + return flag + +def array_contain_prime(arr): + flag=False + for x in arr: + if(IsPrime(x)): + flag=True + print(x) + return flag + +arr=[1,2,5,6,7,11,15] +# arr = int(raw_input('Enter how many elements you want: ')) +# for i in range(0, arr): +# x = raw_input('Enter the numbers into the array: ') +print(array_contain_prime(arr)) + + diff --git a/UnsortedArray/array_rev_order.py b/UnsortedArray/array_rev_order.py new file mode 100644 index 0000000..6066d91 --- /dev/null +++ b/UnsortedArray/array_rev_order.py @@ -0,0 +1,17 @@ +#print the contents of the array of reverse in order + +# def Array_Reverse_Order(arr): +# b=[] +# x=arr[-1] +# y=arr[0] +# for z in range(x,y,-1): +# b.append(z) +# print(b) +# arr=[1,2,3,4,5] +# Array_Reverse_Order(arr) + +def reverse(a): + x=a[::-1] + print(x) +a=[1,3,5,6,7,8] +reverse(a) \ No newline at end of file diff --git a/UnsortedArray/array_reverse_order.py b/UnsortedArray/array_reverse_order.py new file mode 100644 index 0000000..9b4b319 --- /dev/null +++ b/UnsortedArray/array_reverse_order.py @@ -0,0 +1,10 @@ +# array reverse order + +def reverse_order_array(array): + b=[] + for x in range(array[-1],array[0],-1): + b.append(x) + print(b) + +array=[1,2,3,4,5] +reverse_order_array(array) diff --git a/UnsortedArray/array_smallest.py b/UnsortedArray/array_smallest.py new file mode 100644 index 0000000..d7b0d33 --- /dev/null +++ b/UnsortedArray/array_smallest.py @@ -0,0 +1,11 @@ +#Find the smallest array of an integer + +def Smallest_Array(arr): + Init_Small=arr[0] + for x in arr: + if(xcountmax): + countmax=count + mode=i + + return mode +arr=[5,8,3,2,3,3,3,2,6,9] +print(mode_array(arr)) + + + diff --git a/UnsortedArray/number_times_largest_found.py b/UnsortedArray/number_times_largest_found.py new file mode 100644 index 0000000..e62ac11 --- /dev/null +++ b/UnsortedArray/number_times_largest_found.py @@ -0,0 +1,19 @@ +#found the no of times largest integer is found in array + +def Largest_Array(arr): + Init_Large=arr[0] + for x in arr: + if(x>Init_Large): + Init_Large=x + return Init_Large + +def Largest_Array_Count(arr): + count=0 + for x in arr: + if(Largest_Array(arr)==x): + count+=1 + + return count,Largest_Array(arr) +arr=[1,2,3,4,5,5,5,1] +print(Largest_Array_Count(arr)) + diff --git a/UnsortedArray/number_times_x.py b/UnsortedArray/number_times_x.py new file mode 100644 index 0000000..8007173 --- /dev/null +++ b/UnsortedArray/number_times_x.py @@ -0,0 +1,14 @@ +#return the no of times found in x + +def number_times(arr,x): + count=0 + + for i in arr: + if i==x: + count+=1 + return count +arr=[1,2,3,4,3,1] + +print(number_times(arr,1)) + + \ No newline at end of file diff --git a/UnsortedArray/numer_Smallest_array_found.py b/UnsortedArray/numer_Smallest_array_found.py new file mode 100644 index 0000000..f6174eb --- /dev/null +++ b/UnsortedArray/numer_Smallest_array_found.py @@ -0,0 +1,15 @@ +#found the no of times smallest integer is found in array +def smallest_count(array): + smallest=array[0] + count=0 + for arr in array: + if(arrk): + count+=1 + return count +array=[1,4,8,12,4,6,2] +k=2 +print(Count_Values_x(array,k)) + From 3a99d146cc7481a65c16d74a85bc6cf010ab3f34 Mon Sep 17 00:00:00 2001 From: Maria <46182261+Maria16pca111@users.noreply.github.com> Date: Fri, 12 Apr 2019 10:43:15 +0530 Subject: [PATCH 2/2] Set theme jekyll-theme-leap-day --- _config.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 _config.yml diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..b849713 --- /dev/null +++ b/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-leap-day \ No newline at end of file