logotransparent.png

Legion of Learners

www.lol-101.com

  • Home

  • Classrooms

  • Courses

  • About Us

    • Executive Team
    • Board Members
  • Resources

  • More

    Use tab to navigate through the menu items.
    To see this working, head to your live site.
    • Categories
    • All Posts
    • My Posts
    mr.ricklu
    Dec 14, 2020

    12/13 Homework: Data structures and algorithms

    in CS Fundamentals for ACSL

    Finish the problem we started in class

    Sample input:

    J, A, V, A

    1

    2

    4

    12

    21


    Sample output:

    18

    17

    32

    30

    66


    Test input:

    X, R, A, Y

    3

    12

    27

    31

    35


    Test output:

    25

    38

    62

    48

    31


    1 comment
    0
    Shravya S
    Dec 20, 2020

    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)

    0
    1 comments

    Questions? Email us at legionoflearners@gmail.com or join our WeChat group!

    • lol-101dotcom

    ©2020 Legion of Learners