Hurry to write on, someone must be anxious to see, ah haha haha, laughing and joking
No, I got up early.
What is the use of debris time ah, really deep learning, is the need for large segments of the time not interrupted
1. Complete realization of the following types of input data;
2. Legacy: The last elif, not else, do not know how to write, first to celebrate;
Directions = (' North ', ' South ', ' East ', ' West ', ' off ', ' up ', ' left ', ' right ', ' back ') verbs = (' go ', ' Stop ', ' kill ', ' eat ') , ' open ') Stop_words = (' The ', ' in ', ' of ', ' from ', ' on ', ' it ', ' the ', ' the ', ' the ', ' the ') nouns = (' door ', ' Bear ', ' Princess ', ' cabinet ') def scan (sentence): a= sentence.split () direction = (' direction ') verb = (' verb ') Stop = (' stop ') noun = (' noun ') stop = (' stop ') Senten = [] for x in A:If x in di Rections:senten.append ((direction,x)) Elif x in Verbs:senten.append ((verb,x)) Elif x in Stop_words:senten.append ((stop,x)) Elif x in Nouns:senten.a Ppend ((noun, x)) Elif x.isupper (): Senten.append ((' Error ', x)) Elif x not in (directio NS, stop_words, nouns): try:senten.append ((' Number ', int (x))) except Val Ueerror: Senten.append (' Error ', x) ' Return Senten
Learnpython Notes: ex48 code