1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] My code doesnt work for all situations apparently in hackerrank [closed]

Discussão em 'Python' iniciado por Stack, Setembro 16, 2025.

  1. Stack

    Stack Membro Participativo

    Im new to python and want to compete in this hackathon in hackerrank. I don't understand where I'm going wrong pls help

    #!/bin/python3
    t = int(input().strip())
    masterlist=[]
    for a0 in range(t):
    n = int(input().strip())
    i=1
    while i<n:
    if i%3== 0 or i%5 == 0:
    masterlist.append(i)
    i+=1
    print(sum(masterlist))
    masterlist=[]


    this was my code

    and this is what they gave as output

    [​IMG]

    Continue reading...

Compartilhe esta Página