Finish the problem we started in classSample input:J, A, V, A1241221Sample output:1817323066Test input:X, R, A, Y312273135Test output:2538624831
My code works for the input JAVA but not for all of XRAY...
word = input().split(', ')
def multiplier(number, points):
index = 0
word_score = False
for value in number:
if value % 6 == 3:
points[index] *= 2
elif value % 5 == 0:
points[index] *= 3
elif value % 7 == 0:
if word_score == False:
sum = 0
for element in points:
sum += element
points[index] = sum * 2
del(points[:index])
index = 0
word_score = True
elif value % 8 == 0:
if word_score == False:
sum = 0
for element in points:
sum += element
points[index] = sum * 3
del(points[:index])
index = 0
word_score = True
index += 1
if type(points) == int:
return [points]
else:
return points
grand_total = []
for i in range(0, 5):
score = []
for letter in word:
if letter == 'A' or letter == 'E':
score.append(1)
elif letter == 'D' or letter == 'R':
score.append(2)
elif letter == 'B' or letter == 'M':
score.append(3)
elif letter == 'V' or letter == 'Y':
score.append(4)
elif letter == 'J' or letter == 'X':
score.append(8)
start = int(input())
num_list = [start, start + 1, start + 2, start + 3]
multiplier(num_list, score)
sum = 0
for item in score:
sum += item
grand_total.append(str(sum))
for item in grand_total:
print(item)