primes=primes+(var1) TypeError: can only concatenate tuple (not "int") to tuple explain please i stated prime=() at start
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.
You could serve the same purpose with lists if you would like. primes = [] primes.append(var1)
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.
Join our real-time social learning platform and learn together with your friends!