Can someone explain this to me


#1

Can someone please explain to me what the rules are for finding the answer to this?

(1, 2, 3) + (4, 5, 6)


#2

Not sure I get the question. Are you trying to combine the two into one (which that statement will do),

(1, 2, 3, 4, 5, 6)

or are you doing matrix addition:

(5, 7, 9)

?

Eg.

>>> y = list(zip((1,2,3),(4,5,6)))
>>> z = []
>>> for a in y:
	p, q = a
	z.append((p + q))

	
>>> z = tuple(z)
>>> z
(5, 7, 9)
>>>

#3

SORRY, I'm a beginner. Just getting my feet wet. Your answer did help. I'm not doing dot matrix addition. trying to combine the two into one. what is the proper name for this operation?


#4

List concatenation. When we concatenate two lists or two tuples (as above) they combine to form one list or tuple, as the case may be.

Expect to be working more with lists in the earlier going.

[1, 2, 3] + [4, 5, 6] 

[1, 2, 3, 4, 5, 6]

[edit]

As matrices go, if we are aware of operations in our environment, we may devise constructs and data structures with relative ease.

>>> y = list(zip((1,2,3),(4,5,6),(7,8,9),(10,11,12)))
>>> y
[(1, 4, 7, 10), (2, 5, 8, 11), (3, 6, 9, 12)]
>>>

(22, 26, 30)    # visually

#5

great explanation. Got it. Hope I'll be able to help someone the way you've helped me. Any suggestions on learning? I'm starting with python then R to be followed by SQL. What do you think? My goal is to become a data scientist, GOD willing.


#6

I would definitely lab up some tutorials on google cloud or azure, use codecademy for learning code and try and apply these methods playing with raw data forms, learning the language is just the beginning, but understanding how it's applied in real word data analysis maybe feel like a new world if you don't apply learning both together. You seem to be on the right path good luck


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.