Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Pokedex-ChatBot/GeneralInput.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
21 lines (21 sloc)
1.27 KB
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 inputFunction (): #used to gather information from the user | |
questionOriginal=input("Type Something: ") | |
question=questionOriginal.lower() # a new string that can be modified for analizing purposes | |
for i in reversed(range(len(question))): | |
if question[i] in "!?.": # deleting unneccery simbols from the input | |
question=question.replace("!", '') | |
questionOriginal=questionOriginal.replace("!", '') | |
if len(question)==0: | |
break | |
question=question.replace("?", '') | |
questionOriginal=questionOriginal.replace("?", '') | |
if len(question)==0: | |
break | |
question=question.replace(".", '') | |
questionOriginal=questionOriginal.replace(".", '') | |
if len(question)==0: | |
break | |
originalWordList=questionOriginal.rsplit() #Spliting up the words into a list for the original input | |
wordList=question.rsplit() #Spliting up the words into a list for the purpose of analizing them | |
returnList=[wordList,originalWordList] #returning everything in a list | |
return (returnList) |