<reponame>RajdeepJuneja/ga-learner-dsmp-repo<gh_stars>0
# --------------
#Code starts here

def read_file(file_path_1):
    file1 = open(file_path_1,'r')
    sentence_1 = file1.readline()
    file1.close()
    return sentence_1
message_1 = read_file(file_path_1)
print(message_1)

def read_file(file_path_2):
    file2 = open(file_path_2,'r')
    sentence_2 = file2.readline()
    file2.close()
    return sentence_2
message_2 = read_file(file_path_2)
print(message_2)
def fuse_msg(message_a,message_b):
    quotient = int(message_b) // int(message_a)
    return str(quotient)
secret_msg_1 = fuse_msg((message_1) , (message_2))
print(secret_msg_1)




# --------------
##File path for the file 
file_path 

#Code starts here

#Function to read file
def read_file(path):
    
    #Opening of the file located in the path in 'read' mode
    file = open(path, 'r')
    
    #Reading of the first line of the file and storing it in a variable
    sentence=file.readline()
    
    #Closing of the file
    file.close()
    
    #Returning the first line of the file
    return sentence


#Calling the function to read file
sample_message=read_file(file_path)

#Printing the line of the file
print(sample_message)

#Code ends here


# --------------
#Code starts here
message_3=read_file(file_path_3)
print(message_3)
def substitute_msg(message_c):
    if message_c == 'Red':
      sub = 'Army General'
    elif  message_c == 'Green':
      sub = 'Data Scientist'
    else:
      sub = 'Marine Biologist' 
    return sub
secret_msg_2 = substitute_msg(message_3)
print(secret_msg_2 )


# --------------
#Code starts here
message_6 = read_file(file_path_6)
print(message_6)
def extract_msg(message_f):
    a_list = message_f.split()
    even_word = lambda x:len(x) % 2 == 0
   

    b_list =list(filter(even_word,a_list))
    final_msg =" ".join(b_list)
    return final_msg
secret_msg_4 = extract_msg(message_6)



# --------------
# File path for message 4  and message 5
file_path_4
file_path_5

#Code starts here
message_4=read_file(file_path_4)
message_5=read_file(file_path_5)
print(message_4)
print(message_5)
def compare_msg(message_d ,message_e):
    a_list=message_d.split()
    b_list=message_e.split()
   
    c_list=[i for i in a_list if i not in b_list]
    
    final_msg = " ".join(c_list)
    return final_msg
secret_msg_3 = compare_msg(message_4 , message_5)




# --------------
#Secret message parts in the correct order
message_parts=[secret_msg_3, secret_msg_1, secret_msg_4, secret_msg_2]


final_path= user_data_dir + '/secret_message.txt'

#Code starts here
secret_msg = " ".join(message_parts)
def write_file(secret_msg,path):
    open(path,'a+').write(secret_msg)
    close()
    write_file(secret_msg,final_path)

    print(secret_msg)



# --------------
#Code starts here

def read_file(file_path_1):
    file1 = open(file_path_1,'r')
    sentence_1 = file1.readline()
    file1.close()
    return sentence_1
message_1 = read_file(file_path_1)
print(message_1)

def read_file(file_path_2):
    file2 = open(file_path_2,'r')
    sentence_2 = file2.readline()
    file2.close()
    return sentence_2
message_2 = read_file(file_path_2)
print(message_2)
def fuse_msg(message_a,message_b):
    quotient = int(message_b) // int(message_a)
    return str(quotient)
secret_msg_1 = fuse_msg((message_1) , (message_2))
print(secret_msg_1)




# --------------
##File path for the file 
file_path 

#Code starts here

#Function to read file
def read_file(path):
    
    #Opening of the file located in the path in 'read' mode
    file = open(path, 'r')
    
    #Reading of the first line of the file and storing it in a variable
    sentence=file.readline()
    
    #Closing of the file
    file.close()
    
    #Returning the first line of the file
    return sentence


#Calling the function to read file
sample_message=read_file(file_path)

#Printing the line of the file
print(sample_message)

#Code ends here


# --------------
#Code starts here
message_3=read_file(file_path_3)
print(message_3)
def substitute_msg(message_c):
    if message_c == 'Red':
      sub = 'Army General'
    elif  message_c == 'Green':
      sub = 'Data Scientist'
    else:
      sub = 'Marine Biologist' 
    return sub
secret_msg_2 = substitute_msg(message_3)
print(secret_msg_2 )


# --------------
#Code starts here
message_6 = read_file(file_path_6)
print(message_6)
def extract_msg(message_f):
    a_list = message_f.split()
    even_word = lambda x:len(x) % 2 == 0
   

    b_list =list(filter(even_word,a_list))
    final_msg =" ".join(b_list)
    return final_msg
secret_msg_4 = extract_msg(message_6)



# --------------
# File path for message 4  and message 5
file_path_4
file_path_5

#Code starts here
message_4=read_file(file_path_4)
message_5=read_file(file_path_5)
print(message_4)
print(message_5)
def compare_msg(message_d ,message_e):
    a_list=message_d.split()
    b_list=message_e.split()
   
    c_list=[i for i in a_list if i not in b_list]
    
    final_msg = " ".join(c_list)
    return final_msg
secret_msg_3 = compare_msg(message_4 , message_5)




# --------------
#Secret message parts in the correct order
message_parts=[secret_msg_3, secret_msg_1, secret_msg_4, secret_msg_2]


final_path= user_data_dir + '/secret_message.txt'

#Code starts here
secret_msg = " ".join(message_parts)
def write_file(secret_msg,path):
    open(path,'a+').write(secret_msg)
    close()
    write_file(secret_msg,final_path)

    print(secret_msg)
# -------------- #Code starts here # -------------- ##File path for the file #Code starts here #Function to read file #Opening of the file located in the path in 'read' mode #Reading of the first line of the file and storing it in a variable #Closing of the file #Returning the first line of the file #Calling the function to read file #Printing the line of the file #Code ends here # -------------- #Code starts here # -------------- #Code starts here # -------------- # File path for message 4  and message 5 #Code starts here # -------------- #Secret message parts in the correct order #Code starts here