Java, .NET, PHP, PYTHON, ANGULAR, ML, Data Science, Testing, CI Tutorials in Easy Languages.

"Best Software Training, Internship, Project Development center of Indore India, Helpline 780506-3968"

List Special Operation  in Python


We can perform concatenation using + operator, multiplication, or repetition using *  and spiting element of the list using [:] .which has been described by the following example.



a=[1,2,3,7,8,1]
del(a)
b=[4,5,6]
c=a+b
print(c)
c=a*3
print(c)

print(a[1:3])
print(a[1:])
print(a[:3])
print(a[-3:-1])


Assignment of List:-


Check if a key is present in every segment of size k in an array

Find the minimum and maximum element in an array

Write a program to reverse the array

Write a program to sort the given array

Find the Kth largest and Kth smallest number in an array


Find the occurrence of an integer in the array

Sort the array of 0s, 1s, and 2s

Range and Coefficient of array

Move all the negative elements to one side of the array

Find the Union and Intersection of the two sorted arrays

Level 2
Write a program to cyclically rotate an array by one

Find the missing integer

Count Pairs with given sum

Find duplicates in an array

Sort an Array using the Quicksort algorithm

Find common elements in three sorted arrays

Find the first repeating element in an array of integers

Find the first non-repeating element in a given array of integers

Find the largest three elements in an array Time

Rearrange the array in alternating positive and negative items

Find if there is any subarray with sum equal to zero

Find Largest sum contiguous Subarray

Find the factorial of a large number

Find Maximum Product Subarray

Find longest consecutive subsequence

Find the minimum element in a rotated and sorted array

Find all elements that appear more than N/K times

GCD of given index ranges in an array

Minimize the maximum difference between the heights

Minimum number of jumps to reach the end

Find the two repetitive elements in a given array

Find a triplet that sums to a given value

Construct a N*M matrix from the user input

Find the row with the maximum number of 1’s

Print the matrix in a Spiral manner

Find whether an array is a subset of another array

Implement two Stacks in an array

Majority Element

Wave Array

Trapping Rainwater

Level 3
Maximum Index

Max sum path in two arrays

Find Missing And Repeating

Stock buy and sell Problem

Pair with given sum in a sorted array

Chocolate Distribution Problem

Longest Consecutive Subsequence

Print all possible combinations of r elements in a given array


6 Comments

POST Answer of Questions and ASK to Doubt

  1. WAP to count total even number and Odd number in Tuple?
    Sol:-t=(1,2,3,4,5,6,7,8,9)
    count1=0
    count2=0
    for i in t:
    if i%2==0:
    count1=count1+1
    else:
    count2=count2+1
    print("count of even numbers:",count1)
    print("count of odd numbers:",count2)

    ReplyDelete
  2. #Wap to find Negative Elements in list?

    lst=[-2,4,2,-8,5,-4,55,44,-7]
    for i in range(0,len(lst)):
    for j in range(i,len(lst)):
    if lst[i]==lst[i] and lst[i]<0:
    print("Negative Elements",lst[j])
    break

    ReplyDelete
  3. #Wap Program to reverse the list?
    lst=[3,4,2,5,65]
    for i in range(len(lst)-1,-1,-1):
    print(lst[i],end=' ')

    ReplyDelete
  4. #WAP to Find max and min Element in list?
    lst=[44,22,11,55,44]
    maxi=lst[0]
    for i in range(0,len(lst)):
    if maxilst[i]:
    minn=lst[i]
    print("Minimum Element is ",minn)

    ReplyDelete
  5. #WAP to Sort the list using sort() method ?
    lst=[6,4,7,8,2]
    lst.sort()
    print(lst)

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete

Post a Comment

POST Answer of Questions and ASK to Doubt

Previous Post Next Post