#1
September 2nd, 2015, 01:54 PM
| |||
| |||
SET Python Example
I am software engineer and want to learn new programming language Python and want to know important codes of this language. Will you please explain about SET () function of Python language with example also tells me from where I can books of this language?
|
#2
January 8th, 2020, 10:05 AM
| |||
| |||
Re: SET Python Example
I am doing CSE engineering degree and searching for details about the SET Python. Will you tell details about SET Python along with SET Python example also provide Python tutorial to get all details?
|
#3
January 8th, 2020, 10:08 AM
| |||
| |||
Re: SET Python Example
SET Python A set is an unordered collection of items. Every element is unique (no duplicates) and must be immutable (which cannot be changed). Example Create a Set: thisset = {"apple", "banana", "cherry"} print(thisset) Script: # set of integers my_set = {1, 2, 3} print(my_set) # set of mixed datatypes my_set = {1.0, "Hello", (1, 2, 3)} print(my_set) Add items: Add Items To add one item to a set use the add() method. To add more than one item to a set use the update() method. Example Add an item to a set, using the add() method: thisset = {"apple", "banana", "cherry"} thisset.add("orange") print(thisset) Please find the below attached file for the Python tutorial: Python tutorial |