From 26e739017ee3f19fcba759bc30aa382dacc8bead Mon Sep 17 00:00:00 2001 From: "Suraj Choli (cholis)" Date: Wed, 22 Nov 2017 12:11:00 +0000 Subject: [PATCH] Add files via upload added fix for "I am" bug --- Get_Functions.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Get_Functions.py b/Get_Functions.py index 76cd443..8ed1353 100644 --- a/Get_Functions.py +++ b/Get_Functions.py @@ -12,7 +12,7 @@ randomStuff = ["Cherophobia is the fear of fun","A flock of crows is called a mu #========================================================================================================= -def getName(sentence): #Jasper, Richard +def getName(sentence): #Jasper, Richard, Suraj """get the name of the user from the inputed sentence""" userWords = sentence.lower() userWords = userWords.split() @@ -23,6 +23,9 @@ def getName(sentence): #Jasper, Richard # "Howdy, I'm called ____" # Order: Greeting -> pronoun -> Name -> question (optional) # eg. "Hello, I'm Jasper. How are you?" + + if (userWords[0] in greetings): #the added code that stops iam from being added into the name if 2 greeting are added + userWords.pop(0) #pop and not .remove because if (userWords[0] == "i" and len(userWords) > 1):