# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # 1. Problem Statement

# Write a program to identify sub list [1,1,5] is there in the given list in the same order, if yes print "it's a match" if no then print "it's gone" in function.
#
# Example:-
#
# Listy = [1,5,6,4,1,2,3,5] - it's a match
#
# Listy = [1,5,6,5,1,2,3.6] - it's gone

def matchlist(lst):
    sublist = [1,1,5]
    length_lst = len(lst)
    for i in range(0, length_lst):
        if (sublist[0] == lst[i]):
            for j in range(i+1, length_lst):
                if (sublist[1] == lst[j]):
                    for k in range(j+1, length_lst):
                        if(sublist[2] == lst[k]):
                            return print("It's a match")
    else:
        print("It's gone")        



# +
List1 = [1,5,6,4,1,2,3,5]

List2 = [1,5,6,5,1,2,3.6]
print("Match [1,1,5] with [1,5,6,4,1,2,3,5]")
matchlist(List1)

print("\nMatch [1,1,5] with [[1,5,6,5,1,2,3.6]")
matchlist(List2)


# -

# # 2. Problem Statement

# Make a function for prime numbers and use Filter to filter out all the prime numbers from 1-2500

# +
def checkPrime(num):
    if num > 1:
        for i in range(2, num):
            if ( num%i == 0):
                break
        else:
            return True

lst = list(range(2501))     
new_prime_list = list(filter(checkPrime, lst))

print("The prime numbers from 1-2500 are:\n",new_prime_list)
    
# -

# # 3. Problem Statement

# Make a Lambda function for capitalizing the whole sentence passed using arguments and map all the sentences in the list, with the Lambda functions.
#
# ["hey this is sai","i am in mumbai",...]
#
# Output: ["<NAME>ai", "I Am In Mumbai",...]

# +
lst = ["hey this is sai"," i am in mumbai","..."]

print("Capitalizing the first letter of each word \n")
print("Before : ",lst)

capsfirstletter = list(map(lambda lst: lst.title(), lst))
print("After :  ",capsfirstletter)


StarcoderdataJupyterScriptsDedupFiltered