Adobe Scan 01 Feb 2025
Adobe Scan 01 Feb 2025
2024o5 oSu3
Q1. Implement tthe psuedo code belo:
gien
tuple DEFINE tuple 1 As Tuple
START # step 1: Define a
Code:
# step1
tuple 1 =(,2, 3, 4, 5);
tstep 2
print tuple 1 [e
print (tuee 1[-1);
#step3
Sub-tuple tupe 1[1:3;
print (sub-tuple);
#step 4
for elements in tuple1:
print (elements)
#step5
checkValue- 3)
if check. value in tuple 1:
print ("Value found in tupl):
else:
print (Value not found in tuple ):
# step
tuple 2 = (c,7,8);
Con can tenated tuple =tuplettuple
print (concantenatedtue):
# Step 7
a,b, c ((0, 2b.3o);
=
print (a,b,):
4 step8
def
returntuple():
return (Pthon',Tuple","Eyample");
tuple 3 return-tuple();
print (tuple ;
#step9
Dut put:
1
(2,3)
PRINT dict s
END IF
# Step 7: lterating
PRINT keys;"
dictionary
FoR each key IN dit1.keys)
PRINT key
END FOR
#
Using set defaH to add key oth dofaut value
SET dfaut_ value USING dict .st defauHC'gender "Female)
PRINT dicte
Pt (Key-Yalo paits:)
fo key, value in dict1.tems):
print key Nalue);
city
countiy
Values:
Alice
Los Angeles
USA
Key-Value pairs:
name Alice
City Los Angeks
County USA