Tuesday, December 15, 2020

python day 10 tuples

 '''day10 

tuples


example1:

    

colors=(1,2,3)

colors



colors=(255,255,255)

print(colors)



colors=(255,255,255)

print(colors[0:2])


colors=(255,255,255,255,244,23434,3435434,23423423)


type(colors)

print(colors[:])



colors=(255,255,255,255,244,23434,3435434,23423423)


type(colors)

print(colors[:5])


colors=(255,255,255,255,244,23434,3435434,23423423)


type(colors)

print(colors[1:5])



colors=(0,2,25,265,244,23434,3435434,23423423)


type(colors)

print(colors[1:5])



tuple1 = ("abc", 34, True, 40, "male")


tuple1 = ("abc", 34, True, 50, "male")

#it will have attributes llike insert, pop , remove


print(len(tuple1))

'''

tuple1 = ("abc", (1,2,2,2,2,2,22), True, 50, "male")

tuple2=tuple1

print(tuple1)

print(tuple2)

print(id(tuple1),id(tuple1))


No comments:

Post a Comment

python class topic video