TypeError: 'type' object is not subscriptable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • arran
    New Member
    • Oct 2019
    • 1

    TypeError: 'type' object is not subscriptable

    if __name__ == '__main__':
    x = int(input())
    y = int(input())
    z = int(input())
    n = int(input())
    l=[]
    for i in range[0,x+1]:
    for j in range[0,y+1]:
    for k in range[0,z+1]:
    if(i+j+k!=n):
    l.append([i,j,k])
    else:
    break
    print(l)
    Last edited by arran; Oct 12 '19, 08:06 AM. Reason: line 7
  • dwblas
    Recognized Expert Contributor
    • May 2008
    • 626

    #2
    We can't help without proper indentation and a complete error message. I don't know what if statement the
    Code:
    else:
        break
    goes with, but is will cause you to break out of one of the loops.

    Comment

    Working...