What is the output of the following program print (( 1,2 )+( 3,4 ))?

Answer: (1, 2, 3, 4)

In Python (1, 2) and (3, 4) are tuples. When we add two tuples you get a new tuple with

tuple1 = (1,2)
tuple2 = (3,4)

tuple3 = tuple1 + tuple2 = (1,2) + (3,4) = (1, 2, 3, 4)

Python code:

print(( 1,2 )+( 3,4 ))
# output
#(1, 2, 3, 4)
Facebook
Twitter
LinkedIn
Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *

ABOUT ME !!
Johan William

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

RECENT POSTS

TEST