Fewpal
0 votes
194 views
in Information Technology by (47.4k points)
closed by

Cconsider two objects x and y. x is a list whereas y is a Series. Both have values 20, 40,90, 110. 

What will be the output of the following two statements considering that the above objects have been created already

a. print (x*2)

b. print(y*2)

Justify your answer.

1 Answer

+1 vote
by (46.2k points)
selected by
 
Best answer

(a). will give the output as:

[20,40,90,110,20,40,90,110]

(b). will give the output as:

Justification: In the first statement x represents a list so when a list is multiplied by a number, it is replicated that many number of times.

The second y represents a series. When a series is multiplied by a value, then each element of the series is multiplied by that number.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...