Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/alternatingLists.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,14 @@
#ex: ['a','b','c','d'], ['1','2']
#return: ['a','1','b','2','c','d']
def alternating_lists(list1, list2):
pass
Alt_list=[]
if len(list1)>len(list2):
for i in range(len(list1)):
if i<len(list2): Alt_list.extend([list1[i],list2[i]])
else: Alt_list.append(list1[i])
else:
for i in range(len(list2)):
if i<len(list1): Alt_list.extend([list1[i],list2[i]])
else: Alt_list.append(list2[i])
return Alt_list

7 changes: 6 additions & 1 deletion src/text_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@
# output: -1

def text_score(message, positive_word, negative_word):
pass
message_list=message.split()
Score_Count=0
for i in message_list:
if i==positive_word: Score_Count+=1
elif i==negative_word: Score_Count-=1
return Score_Count
5 changes: 4 additions & 1 deletion src/wordValue.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
#example valueDict = {'o': 3, 's': 7} word = 'os'
#return 3+7 = 10
def word_value(valueDict, word):
pass
wordlist=[x for x in word if word!=' ']
sum=0
for k in [valueDict[j] for i in wordlist for j in valueDict.keys() if i==j]: sum+=k
return sum