File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # coding = utf-8
2+ """
3+ def filter_word():
4+
5+ # init
6+ filter_words_list = []
7+ with open("filtered_words.txt", "r") as f:
8+ string_read = f.readline()
9+ while string_read != "":
10+ filter_words_list.append(string_read)
11+ string_read = f.readline()
12+
13+ print("Enter \\ q to exit.")
14+ string_input = input(
15+ "Input your word to check whether it was filtered ->")
16+ while string_input != "\\ q":
17+ if string_input in filter_words_list:
18+ print("Freedom")
19+ else:
20+ print("Human Rights")
21+ string_input = input(
22+ "Input your word to check whether it was filtered ->")
23+
24+ if __name__ == "__main__":
25+ filter_word()
26+
27+ """
28+ # coding = utf-8
29+ __author__ = 'Forec'
30+ word_filter = set ()
31+ with open ('filtered_words.txt' ,"r" ) as f :
32+ for x in f .readlines ():
33+ word_filter |= {x .rstrip ('\n ' )}
34+ while True :
35+ s = input ()
36+ if s == 'exit' :
37+ break
38+ elif s in word_filter :
39+ print ('Freedom' )
40+ else :
41+ print ('Human Rights' )
42+
Original file line number Diff line number Diff line change 1+ ����
2+ ����Ա
3+ ����Ա
4+ �쵼
5+ ţ��
6+ ţ��
7+ ����
8+ ����
9+ love
10+ sex
11+ jiangge
You can’t perform that action at this time.
0 commit comments