Hizkiel Alemayehu
Hizkiel Alemayehu
blank: '0' start state: A table: A: 0: {write: 1, L: B} 1: {write: 0, R: C} B: 0: {write: 1, R: A} C: 0: {write: 1, R: D} D:...
``` def test_reverse_item(items,expected): if reverse_item(items) == expected: return True else: return False def reverse_item(items): last_position= len(items) - 1 new_list= [] for position, item in enumerate(items): new_list.append(items[last_position]) ast_position = last_position -...
``` def test_fab(n,expected): if expected == fab(n): return True else: return False def fab(n): if(n
Here I have proposed a solution, by applying dynamic programming concept. First, I create a list and put all unsuccessful moves in it. So, before searching for the possible moves...
here is what this code does: it takes all coins as sorted input list, so the maximum coin is at index 0. Then it checks if the amount is included...
``` def test_pwr(n, expo, expected): if pwr(n, expo) == expected: return True else: return False def pwr(n, expo): if(expo==0): result = 1 elif(expo==1): result = n else: result = n...
``` def test_quicksort(input_list,start,end,expected): result = quicksort(input_list,start,end) if result == expected: return True else: return False def quicksort(input_list,start,end): start = partition(input_list, start, end, start) if start != len(input_list): start +=1 if(start
@HiImBono example: I t 2* 4 means 2 + 2 + +2 + 2 or 4 + 4 so step 1: 2 + 2 step 2: 2 + 4 step...
my_set.remove("Bilbo") #remove bilbo from the set my_set.add("Galadriel") #adds Galadriel to the set my_set.update(set({"Saruman", "Frodo", "Gandalf"})) #updates my_set by adding "Saruman" and "Gandalf"
The range() function has two sets of parameters. start: Starting number of the sequence. stop: Generate numbers up to, but not including this number. For example, range(0, 4) generates integers...