Skip to content
/ DA_M1_list2 Public template

Data Analytics module 1 , Google's Python Class list 2 activity

Notifications You must be signed in to change notification settings

CodeYouOrg/DA_M1_list2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

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

Data Analytics module 1 , Google's Python Class list 2 activity

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages