coding python

1.Write a Python program to check whether a list contains a sublist.

Example:

a = [2,4,3,5,7] , b = [4,3]

Expected output: b is a sublist of a.

2.Write a Python program to reverse a tuple.

3.Write a Python program to find the repeated items of a tuple.

4. Write your own Python function “Sorting()” to sort any given sequence of numbers in ascending order. For example, if a user enters: 3, 13, 5, 9, 100, 32, 34, 5. Your function should output: 3, 5, 5, 9, 13, 32, 34, 100.

5. A complex number is a number of the form a + bi, whereby a and b are constants, and i is a special value that is defined as the square root of -1. Of course, you never try to actually calculate what the square root of -1 is, as that gives a runtime error; in complex numbers, you always let the i remain. For instance, the complex number 3 + 2i cannot be simplified any further. Addition of two complex numbers a + bi and c + di is defined as (a + c) + (b + d)i. Represent a complex number as a tuple of two numeric values, and create a function that calculates the addition of two complex numbers.

Create a list of restaurants (using tuples) near GWU:

• Restaurant name

• Review score

• Price (Using numbers such as 10, 20, 30, or $.)

Sort the restaurants based on the following rule:

• Review score (descending order) #1 Point

• Price (ascending order) # 1 Point

 
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
ORDER NOW