Python
Python
EXPERIMENT NO. - 1
DESCRIPTION: The greatest common divisor (GCD) of two numbers is the largest
positive integer that divides both of the given numbers without leaving a remainder. In
other words, it is the largest number that is a common factor of both numbers.
CODE :
OUTPUT :
EXPERIMENT NO. - 2
Code:
result = 1
Output:
EXPERIMENT NO. - 3
Code:
def max_value(list):
max = list[0]
min = list[0]
for i in list:
if i > max:
max = i
if i < min:
min = i
lst = []
max_value(lst)
Output:
EXPERIMENT NO. - 4
CODE :
for i in range(len(arr)):
if arr[i] == x:
return i
return -1
if arr[mid] < x:
low = mid + 1
else:
return mid
return -1
lst = []
print("Linear Search:")
if(linearSearch(lst,x)== -1):
print("Element is not found in the list")
else:
print("Element is found at index: ",linearSearch(lst,x))
Output: