Write a function LShift(Arr,n) in Python, which accepts a list Arr of nur
and n is a numeric value by which all elements of the list are shifted to !
Sample Input Data of the list
Arr=[ 10,20,30,40,12,11], n=2
Output
Arr = [30,40,12,11,10,20]
Write a function in Python that counts the number of "Me" or "My" words
Answers
Write a function LShift(Arr,n) in Python, which accepts a list Arr of number and n is a numeric value by which all elements of the list are shifted to!
def Lshift(l, n):
return l[2:] + l[:2]
l = [10, 20, 30, 40, 12, 11]
n = 2
print(Lshift(l, n))
Question:
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]
Solution:
def LShift(Arr,n):
L=len(Arr)
for x in range(0,n):
y=Arr[0]
for i in range(0,L-1):
Arr[i]=Arr[i+1]
Arr[L-1]=y
print(Arr)
LearnMore on Brainly.in:
A binary file “STUDENT.DAT” has structure (admission_number, Name,
Percentage). Write a function countrec() in Python that would read contents
of the file “STUDENT.DAT” and display the details of those students whose
percentage is above 75. Also display number of students scoring above 75%.
https://brainly.in/question/25989972