Output 2
Output 2
Q9. Write a function LShift(Arr,n) in Python, which accepts a list Arr of numbers and n is a
numeric value by which all elements of the list are shifted to left. Sample Input Data of the
list .
Arr= [ 10,20,30,40,12,11], n=2
Output Arr = [30,40,12,11,10,20]
Question:
Write a Python function that takes a list and returns a new list with unique
elements of the first list.
Sample List : [1,2,3,3,3,3,4,5]
Unique List : [1, 2, 3, 4, 5]
def Execute(M):
if M%3==0:
return M*3
else:
return M+10;
def Output(B=2):
for T in range (0,B):
print(Execute(T),"*",end="")
print()
Output(4)
Output()
Output(3)
def main1():
Moves=[11, 22, 33, 44]
Queen=Moves
Moves[2]+=22
L=len(Moves)
for i in range (L):
print ( "Now@", Queen[L-i-1], "#", Moves [i])
main1()
Q13. What will be the output of the following code?
def disp(str):
m=' '
for i in range(0,len(str)):
if(str[i].isupper()):
m=m+str[i].lower()
elif str[i].islower():
m=m+str[i].upper()
else:
if i%2==0:
m=m+str[i-1]
else:
m=m+"@"
print(m.swapcase())
disp('StudyBag$2024')