Skip to content
Permalink
Browse files
placed taking unwanted characters into determinUserInput so the sente…
…nce is left with no , . ? !
  • Loading branch information
dahilj committed Nov 3, 2017
1 parent e9350d2 commit 9e3170c9a96c91c32972d00d8190fb1c9c919d75
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
@@ -14,15 +14,7 @@ randomStuff = ["Cherophobia is the fear of fun","A flock of crows is called a mu

def getName(sentence):
"""get the name of the user from the inputed sentence"""
#first - getting rid of unwanted chars
unwantedChar = [".","'","!","?",","]
newSentence = ""
for char in sentence:
if char not in unwantedChar:
newSentence = newSentence + char
newSentence = newSentence.lower() # makes all letters into lowercase - much easier and more efficient

userWords = newSentence.split() #the sentence is split up into words and put into a list
userWords = sentence.split() #the sentence is split up into words and put into a list

# ways of introduction:
# "Hello, my name is ___"
@@ -9,12 +9,17 @@ def determineUserInput(sentence):
response = ""
sentence = sentence.lower()
sentenceParse = sentence.split()

#first - getting rid of unwanted chars
unwantedChar = [".","'","!","?",","]
newSentence = ""
for char in unwantedChar:
sentence.replace(char,"")

if sentenceParse[0] in questionStarters: # ------------- execute the "what is" code here ---------------
response = respondQuestion(sentence), 2
elif sentenceParse[0] in greetings:
response = getName(sentence), 1
elif sentence[0] in "abcd":
elif sentenceParse[0] in "abcd":
response = sentence, 3
else:
response = sentence, 0

0 comments on commit 9e3170c

Please sign in to comment.