Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In Python 3 Guidelines You must have at least one loop in each function. You are not allowed to import anything. From built-in functions, you
In Python 3
Guidelines You must have at least one loop in each function. You are not allowed to import anything. From built-in functions, you are allowed to call int() and range () only. You are not allowed to use strings, lists, tuples, sets, dictionaries You are not allowed to use anything that hasn't been covered in class (e.g. list comprehension) Don't forget to review the "assignment basics" file Insert comments in the lines you deem necessary count_multiples (numl, num2, N) Description: Returns the number of multiples of N that exist between num] and num2 inclusive. Parameters: numl (int), num2 (int), N (int). numl and num2 can be in any order. N cannot be 0. Return value: int + Examples: count_multiples (2, 13, 3) count_multiples (17, -5, 4) count_multiples(-10, -5, -3) skip_sum(numl, num2, N) Description: Returns the sum of the integers between numl and num2 inclusive but it skips every Nth number in this sequence. Parameters: numl (int), num2 (int), N (int). numl and num2 can be in any order. N is always larger than 1. Return value: int Examples: skip sum(2, 14, 3) skip_sum(4, -3, 2) 70 + + # =2+3+5+6+8+9+11+12+14 | 4,7,10,13 skipped # =-3-1+1+3 | -2,0,2,4 skipped cubic_root (num) Description: Given a positive number num, it returns its cubic root only if it's a whole number. You're not allowed to use the ** operator. Parameters: num (int) Return value: The cubic root as int otherwise None Examples: cubic_root(8) cubic_root(125) cubic_root (10) 2 5 None count_moves (start, end, step) Description: It counts how many moves you need to get from start to end with a step of step by following two rules: 1) if a move lands you on a number ending with 3 or 5 your step is increased by 3 or 5 respectively, 2) if a move lands you on a number ending with 7 or 8 you're automatically transferred ahead by 7 or 8 positions respectively and this transfer doesn't count as a move neither as a landing on a new number. The last move can land either on end or any number larger than this. Parameters: start (int), end (int), step (int) are all positive, end is larger or equal to start. Return value: int Examples: count_moves (1, 30, 1) count_moves (2, 17, 2) 30 + 5 4 # 1 + 2 + # 2 + 4 + 6 + 7 = 14 18 - 26 + 8 - 16 + 18 max_dna (num) Description: In a DNA sequence (e.g. AAAGTCTGAC) we use the letters A, C, G, T to represent the four nucleotide bases. But in order to make the storage more efficient we are going to represent a sequence with a number instead of a string. To do that, we'll use the following mapping: A-1, C-2, G-3, T -4. Therefore, the sequence AAAGTCTGAC will be represented with the integer 1113424312. Given a DNA sequence represented by num, this function returns its most frequent nucleotide base (assume there is no tie) Parameters: num (int) Return value: string Examples: max_dna (1113424312) max_dna (42133133243132) TA' 'G' Extra credit (10 pts) scrabble_number(num) Description: Returns a scrabbled version of num by swapping the two digits of every consecutive pair of digits starting from the right. Parameters: num (int) Return value: int Examples: scrabble_number (123456) 214365 scrabble_number (4739917) 4379971 # the tester contains only 2 out of 10 test cases that will be used for grading this functionStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started