diff --git a/Code/Bubblesort.py b/Code/Bubblesort.py new file mode 100644 index 0000000..083cc89 --- /dev/null +++ b/Code/Bubblesort.py @@ -0,0 +1,7 @@ +list=eval(input("Enter list of elements:")) +n=len(list) +for i in range(n): + for j in range(0,n-i-1): + if list[j]>list[j+1]: + list[j],list[j+1]=list[j+1],list[j] + print("List after sorting:",list) diff --git a/Code/Sumoftwonumbers.py b/Code/Sumoftwonumbers.py new file mode 100644 index 0000000..c447367 --- /dev/null +++ b/Code/Sumoftwonumbers.py @@ -0,0 +1,9 @@ +#python program to add two numbers +x = input("Enter a number: ") +y = input("Enter another number: ") + +sum = int(x) + int(y) + +print("The sum is: ", sum) +Footer +© 2022 GitHub, Inc. diff --git a/linearsearch.py b/linearsearch.py new file mode 100644 index 0000000..7a08538 --- /dev/null +++ b/linearsearch.py @@ -0,0 +1,8 @@ +list=[6,9,19,34,21,43,89] +n=int(input('enter a number')) +for i in range(len(list)): + if list[i]==n: + print('found at pos',i+1) + break +else: + print('not found')