Practice Python Problems with LadderPuzzles | Ver. A

It’s okay to not know how to solve the problems and skip them after 5 minutes.

Finish the function has999(nums) below to return True if there are at least three items in the list nums that are adjacent and all equal to 9, otherwise return False.

Finish the function sum7(nums) to return the sum of all numbers in the list nums that are not 7 and not immediately after a 7.

Return 0 for an empty list or if there is no qualifying number after a 7. There can be multiple 7s in the list.

Please do not scan the page to see the completed previous problems. Try to solve the problem on your own first.

It’s okay to not know how to solve and skip it after 5 minutes.

Finish a function sum_skip2(nums) that takes a list of integers and returns their sum, but whenever two adjacent 2s are found, skip both of them and the number immediately after the pair. Return the sum of the numbers that are not skipped.

Finish the function is_ascending(nums) that returns True if the list contains at least three consecutive numbers that are in ascending order (where equal adjacent values do not count as ascending), and False otherwise.

If the list has less than 3 numbers in it, return False.

Before you write code, what steps will you take to approach this problem? You can write your plan in the space below.

Write a total45(nums) function that takes a list of integers and returns the sum of all items in the list, excluding any numbers that fall within a 4-to-5 sequence (inclusive).

A 4-to-5 sequence starts at a 4 and ends at the next 5, and all numbers between them (including the 4 and 5 themselves) are excluded from the sum. If present, there will always be exactly one 4 and one 5, and the 4 will always appear before the 5.

Before you write code, what steps will you take to approach this problem? You can write your plan in the space below.

You have attempted of activities on this page