Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3) Set is an unordered collection of data types that is iterable, mutable, and has no duplicate elements. The order of elements in a set

3) Set is an unordered collection of data types that is iterable, mutable, and has no duplicate elements. The order of elements in a set is undefined though it may consist of various elements. (display each of the following results a) Create an empty set (blank set) b) Create a set from a given string "COMP2150 python" c) Create a set from the following list: Lst = ["North", "East", "South" ,"West","East", "East"] d) Create a Set with a mixed type of values (Having numbers and strings) [1, 2, 'North', 4, 'East', 6, 'South',33,77]

4) Dictionary { } is a "powerful" built-in data structure in terms of "performance". We will discuss that later in the data structure lecture(s). Similar to the list[ ], there are multiple ways of creating a dictionary data structure. dict{ key, value} Within a directory (dict(..), keys cannot have duplicates, but duplicate values (any datatype) are allowed. Python has a built-in dict() method to create a dictionary data type For this exercise: create a dictionary data type (d1) a) Create an empty dictionary data type b) Create a dictionary with Integer Keys eg: { 1: "COMP', 2: '2150', 3:' python' c) Create a dictionary with mixed keys {'name': 'COMP'. 1:[1,2,3,4] d) Create a dictionary using the build-in dict() method {1: 'COMP', 2: '2150', 3: 'python'} e) Create a dictionary with each item paired. (using dict()) i. [(1, 'COMP'), (2, '2150'), (3, 'python')]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions