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] Python List Index Error

Discussão em 'Python' iniciado por Stack, Julho 23, 2025.

  1. Stack

    Stack Membro Participativo

    Here is my version of the code right now and I keep getting list index error.

    n = 0
    y = len(list1)-1
    while n < y:
    for k in list1:
    if list1[n]+ k == g:
    print("The 2 prime numbers that add up to ",g,"are ", list1[n]," and ",k,".")
    break
    else:
    n = n+1

    Continue reading...

Compartilhe esta Página