Ask your own question, for FREE!
MIT 6.189 A Gentle Introduction to Programming Using Python (OCW) 16 Online
OpenStudy (microbot):

primes=primes+(var1) TypeError: can only concatenate tuple (not "int") to tuple explain please i stated prime=() at start

OpenStudy (rsmith6559):

Tuples are immutable ( can't be changed ). To "change" a tuple, technically you create a new tuple and replace the old one. Reread the docs on tuples with this in mind and it will make sense.

OpenStudy (anonymous):

You could serve the same purpose with lists if you would like. primes = [] primes.append(var1)

OpenStudy (microbot):

I kind of resolved now the problem by adding a comma after var1....so i guess Python is a very (cant find the word) comfortable (?) language. ty both of u guys for answering I'm giving medal to @rsmith6559 as he actually explained me why i get this error but @kTwitch -es answer is very important aswell.(only problem is i cant use lists yet as lectures not there yet:P) but its very nice to know i have so many choices to resolve a problem.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!