By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,960 Members | 2,246 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,960 IT Pros & Developers. It's quick & easy.

TypeError: 'type' object is not subscriptable

P: 1
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)
5 Days Ago #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 621
We can't help without proper indentation and a complete error message. I don't know what if statement the
Expand|Select|Wrap|Line Numbers
  1. else:
  2.     break
goes with, but is will cause you to break out of one of the loops.
3 Days Ago #2

Post your reply

Sign in to post your reply or Sign up for a free account.