Monday, December 9, 2019

Write a program for tuple packing in python

Tuple packing:
====================================

t=(10,20,30,40)
a,b,c,d=t
print("a=",a,"b=",b,"c=",c,"d=",d)

output:
a= 10 b= 20 c= 30 d= 40



Tuple packing for strings:
==============================
t="abcd"
a,b,c,d=t
print("a=",a,"b=",b,"c=",c,"d=",d)

output:
a= a b= b c= c d= d

No comments:

Post a Comment

python class topic video