Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Exercise: Highs and Lows

Sumit Rawal answered on May 18, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers

  • Solution Review: Highs and Lows

  • Exercise: Highs and Lows

    0

    Problem Statement

    You must implement the count_low_high() function. Its parameter is a list of numbers.

    If a number is greater than 50 or divisible by 3, it will count as a high. If these conditions are not met, the number is considered a low.

    At the end of the function, you must return a list that contains the number of lows and highs, in that order.

    In case the list is empty, you may return None.

    Sample Input

    num_list = [20, 9, 51, 81, 50, 42, 77]

    Sample Output

    [2, 5] # 2 lows and 5 highs

    Coding Challenge

    Take some time to figure out the smartest way to solve this problem. Python’s built-in functions are also available to you. Try using them to approach and solve this problem.

    If you feel stuck, you can refer to the solution review in the next lesson.

    Good luck! 

    Popularity 1/10 Helpfulness 1/10 Language whatever
    Source: Grepper
    Tags: whatever
    Link to this answer
    Share Copy Link
    Contributed on May 18 2023
    Sumit Rawal
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.