We would like to implement the lexical order

Assignment Help Python Programming
Reference no: EM13165803

We would like to implement the lexical order for lists. For simplicity, we only consider lists of numbers, where <, <=, ==, >, >= have their usual meaning.

Write a function compL(L1, L2), where L1, L2 are lists of numbers; the function should return -1 if L1 comes before L2 in lexical order, 0 if L1 == L2, and 1 otherwise.
[Recall the lexical order for lists: We skip the longest common prefix of L1 and L2; then we compare the next entry of L1 and the next entry of L2, and return the result of that comparison. In the special case where L1, L2 both have no next entry after their common prefix, we conclude that L1 == L2. In the special case where L1 has no next entry but L2 does, we conclude that L1 comes first; if L2 has no next entry but L1 does, we conclude that L2 comes first.] Simply put, we are not just going to say L1 > L2 or if L1 < L2. We are supposed to write a program that basically recreates the lexical order in lists.

Reference no: EM13165803

Questions Cloud

Optimization is to add a sorting algorithm : The second optimization is to add a sorting algorithm. Each time you add an item to the array (from disk or from keyboard), you call a function called SortMyArray(), which use the bubble sorting algorithm to sort the array in the ascending order, ..
The load master for a freighter : The load master for a freighter wants to determine the mix of cargo to be carried on the next trip. The ship's volume limit for cargo is 100,000 cubic meters, and it weight capacity is 2,310 tons.
Storage systems increasingly rely on the internet : Storage systems increasingly rely on the Internet infrastructure as a transport medium. What are the advantages of this approach? What problems are present in terms of security and reliability?
Slugworth candies : Slugworth Candies, LLC, is a candy maker company that employs 450 people. The company is composed of six departments: Executive Staff (20), Human Relations (6), Finance and Accounting (15), Marketing and Sales (15), Factory (150), and Research & D..
We would like to implement the lexical order : We would like to implement the lexical order for lists. For simplicity, we only consider lists of numbers, where , >= have their usual meaning.
Write a program using for loops t : Write a program using for loops to produce the following output. Please read carefully the entire specification!
Gradesaverage, which prompts user : Write a program called GradesAverage, which prompts user for the number of students, reads it from the keyboard, and saves it in an int variable called numStudents. It then prompts user for the grades of each of the students and saves them in an i..
Consider an array of integers : Consider an array of integers as below: int[] a = {5, 2, -4, 3, 0, -5, 7, 11, 6, 13} Complete the method named count(int[] a) in the class Count. The method should return the number of positive numbers in the array
The interest rate per period : The interest rate per period. For example, if your loan's interest is 6.5% per year, and you are paying monthly, this would be 6.5%/12. If you are paying every two weeks, r would be 6.5%/26, because there are 26 two-week periods in a year.

Reviews

Write a Review

Python Programming Questions & Answers

  Most popular name would be the one with the biggest number

the program will ask you to insert the year that the user is interested in, then ask the gender that the user is interested in, and print out the most popular names corresponding to the year and gender. FYI, the number on the right represents how man..

  Write a program to receive a series of numbers

Write a program to receive a series of numbers (including decimal) from the user until enter key is pressed. Process the input data and display number count, sum and average. Use proper data type and format.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Function should return a dictionary

Write a function numOccur(s), where s is a string; the function should return a dictionary whose keys are the 26 ascii letters abcdefghijklmnopqrstuvwxyz

  The interest rate per period

The interest rate per period. For example, if your loan's interest is 6.5% per year, and you are paying monthly, this would be 6.5%/12. If you are paying every two weeks, r would be 6.5%/26, because there are 26 two-week periods in a year.

  Program to do the enciphering

Write a program to do the enciphering. It should prompt the user for a message, and print out both the entered message and its corresponding ciphertext.

  Define three types of programming errors

Define three types of programming errors and explain with examples

  Permutation ciphers

Permutation Ciphers (a.k.a. Transposition Ciphers) are another class of simple cryptosystems. For this we use the functions apply(.,.) and inv(.) from Homework 4; copy these two functions into your le as auxiliary functions.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Define a function to calculate the values

Be sure to define a function to calculate the values and print the table displaying the interest rate in the first column, the monthly payment in the second column, and the total payment in the third column. Your program should not allow the user to ..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd