This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |