TUPLES
Aim: Implement
a Program to implement the concept of tuples.
Algorithm:
1.Start
2.Create
a Zero-element tuple tuple a=()
3. Create a One-element tuple b = ("one",)
4. Create a Two-element tuple c = ("one", "two")
5.Print tuples and length.
6.Stop
Program:
# Zero-element tuple.
a = ()
# One-element tuple.
b = ("one",)
# Two-element tuple.
c = ("one", "two")
print(a)
print(len(a))
print(b)
print(len(b))
print(c)
print(len(c))
Output:
()
0
('one',)
1
('one', 'two')
2
0 Comments:
Post a Comment