Lab 3 TUPLE
>>> tup1=(5,10,15,20,25)
>>> print(len(tupt))
5
>>> print(tup1[4])
25
>>> print(tup[5]) #fifth index not present
Traceback (most recent call last):
File "", line 1, in
print(tup[5])
NameError: name ‘tup! is not defined
>>> print(tup1[4:5])
(25,)
>>> tup1[2]=12 #tuples are immutable
Traceback (most recent call last):
File "", line 1, in
tup1[2]=12
TypeError: ‘tuple’ object does not support item assignment
>>> print(tup1)
(5, 10, 15, 20, 25)
>>> tup1=tup1+(8,9) #adds 8 and 9 to the tuple
>>> print(tup1)
(5, 10, 15, 20, 25, 8, 9)gem_prices = { "Emerald": 1760, “Ivory”: 2119, "Jasper": 1599,
uby": 3920, "Garnet”: 3999 }
t{input("how many different gem stones you want:"))
req_gem=dict()
for jin range(0,n):
str=input(“enter the stone:")
p=int(input("enter its quanti
req_gem[str]=p
bill_amount = 0
for gem in req_gem:
if gem in gem_prices:
price = gem_prices[gem] * req_gem{gem]
bill_amount += price
else:
elif bill_amount>30000:
bill_amount=bill_amount-(bill_amount*0.05)
print("Final Price:",bill_amount)
a,b,c=map(int,input().split())
if(((a+b)<=c)or((b+c)<=a)or((c+a)<=b)):
print(“cannot form triangle")
else:
print("triangle can be formed”)counter1=0
counter2=5
it=counter2
while countert<5:
sta
while counter2>counter1:
star=start"*"
counter2-=1
print (star)
counter1+=1
counter:
heads = int(input('Enter the total number of heads:’))
legs = int(input(‘Enter the total number of legs:"))
if legs % 2 !=0 or heads ==0 or heads > legs:
print('No solution’)
else:
int((legs + (-2*heads))/2)
c= int(heads - r)
print(‘)} Q-format(c,r))