Question: python help need both functions to be done python help yeu esource/K4vviarYLUJCCN/KUIGI Volv n Java... zy 4.3. Returning value... CS 112 - Spring 2020 -
python help need both functions to be done
python help
yeu esource/K4vviarYLUJCCN/KUIGI Volv n Java... zy 4.3. Returning value... CS 112 - Spring 2020 - Programming Assignment 4 Loops Due Date: Sunday, February 23rd, 11:59pm The purpose of this assignment is to get practice with loops See the "assignment basics" file for more detailed information about getting assistance, running the test file, grading, commenting, and many other extremely important things. Each assignment is governed by the rules in that document. https://piazza.com/class profile/get_resource/k4wblafqtoj2cx/k5x3ennufm34cg Needed file: the tester for this assignment tester4.py https://piazza.com/class profile/get_resource/k4wblafqtoj2cx/k6rgib2ngsq3ar Background Loops allow us to run the same block of code multiple times in a row. When variables used in that block of code are changed between iterations, we can accumulate effects and process larger batches of data, such as the elements in a sequence (e.g. list, string, file, etc.). There are problems that selection statements alone are insufficient to solve; yet loops add enough power to tackle them. We will use loops to solve various problems. 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 e in Java... zy 4.3. Returning value... 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) 5 4 # # 1 + 2 2 + 4 + 3 + 7 ~ 14 18 - 26 + 6 + 8 16 18 30 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) 0 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 function ed for grad
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
