Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Set Vs Tuple In Python

myset = {"bananas", "apples", "cherries"}
mytuple = ("bananas", "apples", "cherries")
print(myset)
#outputs {'apples', 'cherries', 'bananas'}
print(mytuple)
#outputs ('bananas', 'apples', 'cherries')

myset = {2, 1, 3}
mytuple = (2, 1, 3)
print(myset)
#outputs {1,  2,  3}
print(mytuple)
#outputs (2, 1, 3)

Comment

tuple vs set python

tuple = (1,2,3,4,5,6,7,8,9, 1,2,3) # output: (1,2,3,4,5,6,7,8,9, 1,2,3) will be same
set = (1,2,3,4,5,6,7,8,9, 1,2,3) # output: (1,2,3,4,5,6,7,8,9) // removes the duplicate values
Comment

PREVIOUS NEXT
Code Example
Python :: python write float with 2 decimals 
Python :: 3d data visualization python 
Python :: Converting 12 hour clock time to 24 hour clock time 
Python :: Removing Elements from Python Dictionary Using pop() method 
Python :: simple python program for beginners 
Python :: |safe django 
Python :: python print every row of dataframe 
Python :: pyspark on colab 
Python :: python random numbers 
Python :: cosine similarity numpy 
Python :: object oriented python 
Python :: stack python 
Python :: simple bmi calculator using python 
Python :: single line return python 
Python :: Lambda Functions using for loop 
Python :: class inheritance 
Python :: curly braces in python 
Python :: local variable referenced before assignment 
Python :: tanh activation function 
Python :: django for beginners 
Python :: python print text 
Python :: django delete model from database 
Python :: .save() in django 
Python :: scikit learn 
Python :: sub function python 
Python :: python get file size 
Python :: if elif and else in python 
Python :: print column name and index dataframe 
Python :: Unreadable Notebook: jupyter 
Python :: pd column to one hot vector 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =