Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- print("List of possible functions:\nPrintTo()\nLineChars()\nBackwardsStr()\nCase()\nQuestion()\nEmailCheck()\nStrLen()\nBackwardsSentence()\nCapitalise()\nRandNumMatrix()\nPatternPrint()\nVowels()\nTeacherCodes()\n")
- StrNum = 0
- StrNum2 = 0
- FinalChoice = ("")
- Running = True
- Alphabet = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","!","£","$","%","&","*","(",")","€","¬",":",";","@","#","[","]","{","}"]
- def Reset():
- StrNum = 0
- StrNum2 = 0
- FinalChoice = ("")
- Running = True
- Alphabet = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","!","£","$","%","&","*","(",")","€","¬",":",";","@","#","[","]","{","}"]
- def PrintTo():
- global StrNum,StrNum2
- Reset()
- FirstChoice = input("Enter Words here\n")
- StrNum = int(input("Enter number of letters to print\n"))
- StrNum2 = int(input("Enter number of letter to start at(0 begins at beginning)\n"))
- for i in range (StrNum2,(StrNum2+StrNum)):
- FinalChoice = FinalChoice + FirstChoice[i]
- return FinalChoice
- def LineChars():
- global StrNum
- Reset()
- FirstChoice = input("Enter Words here\n")
- for i in FirstChoice:
- print(FirstChoice[StrNum])
- StrNum = StrNum + 1
- def BackwardsStr():
- Reset()
- FirstChoice = input("Enter Words here\n")
- StrNum = (int(len(FirstChoice)))
- for i in range(0,StrNum):
- StrNum2 = StrNum - i - 1
- FinalString = FinalString + FirstChoice[StrNum2]
- return print(FinalString)
- def Case():
- Reset()
- FirstChoice = input("Enter Words here\n")
- SecondChoice = input("Do you want upper case or lower case? Type 'Upper' or 'Lower'\n")
- if SecondChoice == ("Upper"):
- FirstChoice = FirstChoice.upper()
- elif SecondChoice == ("Lower"):
- FirstChoice = FirstChoice.lower()
- else:
- print("Can't do that! Check your spelling")
- Case()
- print(FirstChoice)
- def Question():
- Reset()
- FirstChoice = input("What is your name?\n")
- print("Hello, " + FirstChoice + ", and bye!")
- def EmailCheck():
- Reset()
- global IsEmail
- global FirstChoice
- IsEmail = False
- FirstChoice = input("Enter your email!\n")
- for i in range(0,(len(FirstChoice))):
- StrNum = (int(i))
- if FirstChoice[i] == "@":
- IsEmail = True
- return A()
- def A():
- if IsEmail == False:
- print("This is not a Valid Email.")
- EmailCheck()
- else:
- print("Thanks! Your Email has been verified (" + FirstChoice + ")")
- def StrLen():
- Reset()
- FirstChoice = input("Enter Words here\n")
- StrNum = len(FirstChoice)
- print(StrNum)
- def BackwardsSentence():
- Reset()
- FirstChoice = input("Enter sentence here\n")
- StrNum = (int(len(FirstChoice)))
- for i in range(0,StrNum):
- StrNum2= StrNum - i - 1
- FinalString = FinalString + FirstChoice[StrNum2]
- return print(FinalString)
- def Capitalise():
- Reset()
- FirstChoice = input("Enter sentence here\n")
- StrNum = (int(len(FirstChoice)))
- FinalChoice = FirstChoice[0].upper()
- for i in range (1,StrNum):
- FinalChoice = FinalChoice + FirstChoice[i].lower()
- return FinalChoice
- print(FinalChoice)
- def RandNumMatrix():
- Reset()
- while Running:
- for i in range(0,234):
- StrNum2 = random.randint(0,((len(Alphabet)) - 19))
- StrNum2 = Alphabet[StrNum2]
- StrNum3 = random.randint(0,234)
- StrNum4 = random.randint(0,((len(Alphabet)) - 19))
- StrNum4 = Alphabet[StrNum4]
- StrNum5 = random.randint(0,((len(Alphabet)) - 19))
- StrNum5 = Alphabet[StrNum5]
- StrNum6 = random.randint(0,((len(Alphabet)) - 19))
- StrNum6 = Alphabet[StrNum6]
- StrNum7 = random.randint(0,((len(Alphabet)) - 19))
- StrNum7 = Alphabet[StrNum7]
- StrNum8 = random.randint(0,((len(Alphabet)) - 19))
- StrNum8 = Alphabet[StrNum8]
- StrNum9 = random.randint(0,((len(Alphabet)) - 19))
- StrNum9 = Alphabet[StrNum9]
- StrNum10 = random.randint(0,((len(Alphabet)) - 19))
- StrNum10= Alphabet[StrNum10]
- StrNum11 = random.randint(0,((len(Alphabet)) - 19))
- StrNum11 = Alphabet[StrNum11]
- StrNum12 = random.randint(0,((len(Alphabet)) - 19))
- StrNum12 = Alphabet[StrNum12]
- StrNum13 = random.randint(0,((len(Alphabet)) - 19))
- StrNum13 = Alphabet[StrNum13]
- StrNum14 = random.randint(0,((len(Alphabet)) - 19))
- StrNum14 = Alphabet[StrNum14]
- StrNum15 = random.randint(0,((len(Alphabet)) - 19))
- StrNum15 = Alphabet[StrNum15]
- FinalChoice = (" ")*StrNum3 + StrNum4 + StrNum5 + StrNum6 + StrNum7 + StrNum8 + StrNum9 + StrNum10+ StrNum11+ StrNum12+ StrNum13+ StrNum14+ StrNum15
- print(FinalChoice)
- def PatternPrint():
- Reset()
- while Running:
- for i in range(0,400):
- StrNum = i
- StrNum2 = random.randint(0,((len(Alphabet)) - 1))
- StrNum3 = StrNum2
- StrNum2 = Alphabet[StrNum2]
- print((StrNum2)*StrNum3)
- def TeacherCodes():
- #This calls the reset function, which clears all the variables so that it doesnt have errors when ran again.
- Reset()
- #This asks for an input, and sets it to the variable FirstChoice
- FirstChoice = input("Enter Name here\n")
- #this sets variable StrNum to the length of the input above
- StrNum = (int(len(FirstChoice)))
- #this sets the variable FinalChoice to a blank string.
- FinalChoice = ("")
- #this is a for-loop that runs for the length of StrNum, which is the length of the FirstChoice, the input.
- #I do this so it can check the entire sentences letters in order.
- for i in range (StrNum):
- #this checks if there is a space in the word which lets it know it is a Surname and Forename.
- if FirstChoice[i] == " ":
- #this code puts the first letter of the first word, first letter of the second word,
- #and last letter of the second word in a seperate string
- FinalChoice = FinalChoice + FirstChoice[0]
- FinalChoice = FinalChoice + FirstChoice[i+1]
- FinalChoice = FinalChoice + FirstChoice[StrNum-1]
- #this makes the word capital
- FinalChoice = FinalChoice.upper()
- #this returns the final Teachercode.
- return FinalChoice
- def Vowels():
- #This calls the reset function, which clears all the variables so that it doesnt have errors when ran again.
- Reset()
- #This asks for an input, and sets it to the variable FirstChoice
- FirstChoice = input("Enter sentence here\n")
- #this sets variable StrNum to the length of the input above
- StrNum = (int(len(FirstChoice)))
- #this sets the variable FinalChoice to a blank string.
- FinalChoice = ("")
- #this is a for-loop that runs for the length of StrNum, which is the length of the FirstChoice, the input.
- #I do this so it can check the entire sentences letters in order.
- for i in range (StrNum):
- if FirstChoice[i] == "A" or FirstChoice[i] == "E" or FirstChoice[i] == "I" or FirstChoice[i] == "O" or FirstChoice[i] == "U" or FirstChoice[i] == "a" or FirstChoice[i] == "e" or FirstChoice[i] == "i"or FirstChoice[i] == "o" or FirstChoice[i] == "u":
- FinalChoice = FinalChoice + FirstChoice[i]
- return FinalChoice
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement