Code:
def common_end(list1,list2): #function which accepts two
lists
if (list1[0]==list2[0] or list1[-1]==list2[-1]): #checking either
starting element of two lists equal or ending elements of two lists
equal.
#starting and ending elements same condition includes the above two conditions
return True #if elements are same return true
else:
return False #else return false
list1=[1,2,3,4,5]
list2=[3,4,5,6,7,5]
list3=[1,5,6,7,8,5] #three lists creating
list4=[9,6]
print(common_end(list1,list2)) #call common_end function by passing list1,list2 here it returns true since the ending element of two lists are same 5
print(common_end(list1,list3)) #call common_end function by passing list1,list3 here it returns true since the starting and ending elements of two lists are same
print(common_end(list4,list3)) #calling common_end function by passing list4,list3 here it returns false since the starting and ending elements are not same
Code and Output Screenshots:
![def common_end(listi,list2): #function which accepts two lists if (list1[0]==list2[0] or listi[-1] -=list2[-1]): #checking ei](http://img.homeworklib.com/questions/ef9b5e80-82fc-11eb-8da5-bd81925acbaa.png?x-oss-process=image/resize,w_560)

Note: if you have any queries please post a comment thanks a lot..always available to help you...
Exercise 4 Step 1: Create a new editor window and save it as a file named...
In Python use the function design recipe from Chapter 3 of Practical Programming to develop a function named first_last6. The function takes a list of integers. (Assume that the list will not be empty.) The function returns True if a 6 is the first element or the last element or if both the first and last element are 6. Otherwise, the function returns False.
You must create a Java class named TenArrayMethods in a file named TenArrayMethods.java. This class must include all the following described methods. Each of these methods should be public and static.Write a method named getFirst, that takes an Array of int as an argument and returns the value of the first element of the array. NO array lists. Write a method named getLast, that takes an Array of int as an argument and returns the value of the last element...
Step 1: Getting Started Create a new .java file named Lab12.java. At the beginning of this file, include your assignment documentation code block. After the documentation block, you will need several import statements. import java.util.Scanner; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; Next, declare the Lab12 class and define the main function. public class Lab12 { public static void main (String [] args) { Step 2: Declaring Variables For this section of the lab, you will need to declare...
Create the header file named “Complex.h” that contains the following class: The class Complex represents a complex number which is a number of the form a + bi where a and b are real numbers and i2 = −1. The class should contain: Private double field named real. Private double field named imaginary. Public default constructor that assigns 1 to real and 0 to imaginary. Public overloaded constructor that takes a double as a parameter named real. It assigns real...
Exercise 1: Create a file by using any word processing program or text editor. Write an application that displays the file's name, size, and time of last modification. Save the file as FileStatistics.java. Exercise 2: Create a file that contains your favorite movie quote. Use a text editor, such as Notepad, and save the file as Quote.txt. Copy the file contents and paste them into a word processing program, such as Word. Save the file as Quote.doc. Write an application...
write in java 1. Assume the availability of a method named makeLine that can be passed a non-negative integer n and a character c and return a String consisting of n identical characters that are all equal to c. Write a method named printTriangle that receives two integer parameters n and k. If n is negative the method does nothing. If n happens to be an even number, itsvalue is raised to the next odd number (e.g. 4-->5). Then, when k has the value zero, the method prints...
create a class named IntegerQueue given a singlylinkedqueue of integers, write the following methods: max(SinglyLinkedQueue<Integer> s) to return the max element in the queu. min(SinglyLinkedQueue<Integer> s) to return the min element in the queue. sum(SinglyLInkedQueue<Integer> s) to return the sum of elements in the queu. median(SinglyLinkedQueue<Integer> s) to return the median of elements in the queue. split(SinglyLinkedQueue<Integer> s) to separate the SinglyLinkedQueue into two ArrayQueues based on whether the element values are even or odd. package Stack_and_Queue; import java.util.Iterator; import...
a) In Atom, create a new program file named greetByfullName.jsin your pl folder. b) Write a function named greetByfullName that accepts two strings (firstName and lastName), and returns a cheery greeting. c) Test the function by prompting the user to enter their first name, and storing the name in a variable, and then prompting the user for their last name, and storing it in a second variable. This page says Enter your first name Susan Cancel OK This page says...
a) 7% Define a function (the function definition only) named combine_lists that receives two lists of integers (the function has 2 parameters). You can assume that each list is the same length and each list is not empty. The function will create a new list which is composed of the addition of each element of the two lists. The function returns the new list. For example, if the function is sent this list: [2,4,6,8,10] and this list: [5,6,7,8,9] then the...
This program should use a main function and two other functions named playlist and savelist as follows: The main function: The main function should create an empty list named nums and then use a loop to add ten integers to nums, each integer in the range from 10-90. NOTE: In Python, a list is a data type. See Chapter 7. The main function should then call the playlist function and savelist function, in that order. Both of these functions take...