tuple
-
[Python tutorial] 23. Tuple Methods코딩/Python 2022. 12. 21. 17:28
tuple.count(value) Returns the number of times a specified value occurs in a tuple thistuple = (1, 3, 7, 8, 7, 5, 4, 6, 8, 5) x = thistuple.count(5) tuple.index(value) Searches the tuple for a specified value and returns the position of where it was found thistuple = (1, 3, 7, 8, 7, 5, 4, 6, 8, 5) x = thistuple.index(8)
-
[Python tutorial] 8. Data type - Tuple코딩/Python 2022. 12. 21. 17:13
Tuples ordered (indexed) unchangeable allow duplicate values thistuple = ("apple", "banana", "cherry", "apple", "cherry") # allow duplicate values # Data Types: any data types tuple1 = ("apple", "banana", "cherry") tuple2 = (1, 5, 7, 9, 3) tuple3 = (True, False, False) tuple4 = ("abc", 34, True, 40, "male") Create Tuple With One Item: (...,) thistuple = ("apple",) thistuple = ("apple") # NOT a t..