We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f65844f commit a718527Copy full SHA for a718527
tuples_sets_booleans.py
@@ -40,3 +40,22 @@
40
41
for i in range(5):
42
print("i is: ", i)
43
+
44
45
+# The tuple() builtin can be used to create tuples in Python.
46
+# In Python, a tuple is an immutable sequence type.
47
+# One of the ways of creating tuple is by using the tuple() construct.
48
+t1 = tuple()
49
+print('t1 =', t1)
50
51
+# creating a tuple from a list
52
+t2 = tuple([1, 4, 6])
53
+print('t2 from a list =', t2)
54
55
+# creating a tuple from a string
56
+t1 = tuple('Python')
57
+print('t1 from a string =', t1)
58
59
+# creating a tuple from a dictionary
60
+t1 = tuple({1: 'one', 2: 'two'})
61
+print('t1 from a dict =', t1)
0 commit comments