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)) + 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