SHARE
SPREAD
HELP

The Tradition of Sharing

Help your friends and juniors by posting answers to the questions that you know. Also post questions that are not available.


To start with, Sr2Jr’s first step is to reduce the expenses related to education. To achieve this goal Sr2Jr organized the textbook’s question and answers. Sr2Jr is community based and need your support to fill the question and answers. The question and answers posted will be available free of cost to all.

 

#
Authors:
Y Daniel Lang
Chapter:
Sets And Dictionaries
Exercise:
Check Point
Question:8 | ISBN:978013274719 | Edition: 6

Question

Can a list, set, or tuple have elements of different types?

 

TextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbook

Answer

A list is a collection of things,list created by using square brackets[].

list items are orederd,changeble and have different data types so we can create a list contain different datatypes.

list1=[1,56,89.0,"apple"]

A set  is ordered collection of data types that is iterable,mutable,and has no  duplicate elements.

we can create a set having diffrent datatypes,

set1={1,556.0,"banana"}

Tuple is same as list but diiffrence is tuple elements are immutable that means we can not change tupe elements once its created.

tuple has acepted diffrent types of data.

tuple1=(3,56.7,"cherry",45)

0 0

Discussions

Post the discussion to improve the above solution.