Skip to content

Instantly share code, notes, and snippets.

View nolifeasian24-7's full-sized avatar
🌍
observe...

Amal kuriakose nolifeasian24-7

🌍
observe...
View GitHub Profile
@nolifeasian24-7
nolifeasian24-7 / bubblesort.py
Created October 9, 2020 16:22
The bubble sort algorithm in python
def start():
arr = [64,34,25,12,22,11,90]#an array of numbers
lenght = len(arr)#this gets the amount of element (items) in this array
for i in range(lenght-1):#looping through this array
for j in range(0, lenght-i-1):#this then loops through each sought index
if arr[j] > arr[j+1]:
arr[j], arr[j+1] = arr[j+1], arr[j]#these lines compare the indexes and acts accordingly (so if one element is smaller then the other then it will switch places in the list)
print("your sorted array is: ")
for i in range (len(arr)):
print("%d" %arr[i])#print the sorted array
@nolifeasian24-7
nolifeasian24-7 / Cipher.py
Created September 17, 2020 16:43
Cieser cipher in python
def start():
normaltext = input('enter your word/phrase: ')#gahter the string
normaltext1 = normaltext.lower()#convert to lowercase
Alphabets = "abcdefghijklmnopqrstuvwxyz"
shift = int(input('by how much do you want to shift'))#how much the user wants to shift by
cipher =' '
TypeInput = input("choose type + or -")#shifting left or right (names for this i forgot)
if TypeInput == "+":#condition "+"
for d in normaltext1: