Questions for Experiment B

Try to solve the following mixed up code problems. You can use the “Help Me” button to make the problem easier if you have made at least three attempts to solve the problem. After you solve each problem, please answer the poll as well.

Put the code blocks in order to return the sum of the numbers in the list nums, returning 0 for an empty list. Except the number 13 is very unlucky, so it does not count and a number that comes immediately after a 13 also does not count. For example, sum13([13,1,2]) returns 2 and sum13([1,13]) returns 1.

Put the code blocks in order to create a function that takes two numbers as arguments (num, length) and returns a list of multiples of num [num * 1, num * 2, etc] until the list contains length elements. For example, list_of_multiples(8, 4) returns [8, 16, 24, 32] and list_of_multiples (11, 8) returns [11, 22, 33, 44, 55, 66, 77, 88].

Put the code in order to define a function called grammarly that checks whether a word is spelled correctly using the rule “i before e except after c”. For example, it should return False for grammarly('beleive') since the ‘ei’ does not follow a ‘c’, it should return True for grammarly ('receive') since the ‘ei’ follows a ‘c’.

Put the code blocks in order to remove all values from a list of numbers equal to the passed target value and return the modified list. For example, remove_target([5, 2, 5]) returns [2].

You have attempted of activities on this page