Skip to content

CodeYouOrg/list-2-GAVAS1987

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open in Visual Studio Code

Additional Basic List Exercises

Welcome to the additional basic list exercises assignment! This exercise will help you further practice working with lists in Python by implementing a few more functions. Follow the instructions below to complete the assignment.

Instructions

  1. Fill in the Code:

    • You will complete the functions provided in the list2.py file.
    • Each function has a description of what it should do. Your task is to write the code inside each function to achieve the described behavior.
    • The main() function is already set up to call these functions with various inputs and print 'OK' when a function is correct.
  2. Function Descriptions:

    • Remove_adjacent:
      • Given a list of numbers, return a list where all adjacent equal elements have been reduced to a single element.
      • Example: remove_adjacent([1, 2, 2, 3]) should return [1, 2, 3].
    • Linear_merge:
      • Given two lists sorted in increasing order, create and return a merged list of all the elements in sorted order.
      • Ideally, the solution should work in "linear" time, making a single pass of both lists.
      • Example: linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']) should return ['aa', 'bb', 'cc', 'xx', 'zz'].
  3. Testing Your Code:

    • The main() function includes test cases that will help you verify if your implementations are correct.
    • The test() function compares the output of your function with the expected result and prints 'OK' if they match, otherwise it prints 'X'.

Submission

  • Complete as many functions as you can.
  • Ensure your code runs without errors.
  • Submit your completed list2.py file by pushing your repo to GitHub and it will auto grade.

Happy coding!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%