[Solved] finding shorted path to a position using python

you are allowed to remove one wall as part of your remodeling plans. Apparently, the variable saldo represents the number of walls you can remove during your escape. It is decremented when you remove a wall; tests are made to assert whether you are still allowed to remove a wall. 5 solved finding shorted path … Read more

[Solved] Einstein’s puzzle in Scala [duplicate]

val houses = List(1, 2, 3, 4, 5) val orderings = houses.permutations.toList val List(first, _, middle, _, _) = houses def imright(h1: Int, h2: Int) = h1 – h2 == 1 def nextto(h1: Int, h2: Int) = math.abs(h1 – h2) == 1 for (List(red, green, ivory, yellow, blue) <- orderings if imright(green, ivory)) for(List(englishman, spaniard, … Read more

[Solved] sorting in the order of lowercase first then uppercase then digits and sorting the digits to with the odd no first [closed]

I’m assuming this is homework or something and you are supposed to do this a certain way or something? What are the specifications? I shortened your code anyway if that helps in any way p = “Sorting1234” upper_case = sorted([i for i in p if i.isupper()]) lower_case = sorted([i for i in p if i.islower()]) … Read more

[Solved] What does the Python operator ilshift (

It is an BitwiseOperators (Bitwise Right Shift): https://wiki.python.org/moin/BitwiseOperators All of these operators share something in common — they are “bitwise” operators. That is, they operate on numbers (normally), but instead of treating that number as if it were a single value, they treat it as if it were a string of bits, written in twos-complement … Read more

[Solved] Tuple Errors Python

It is saying that on this line: med_sev =(accidents[quotient][1] + accidents[quotient+2][1])/2 you are trying to index something that doesn’t exist. I imagine it is on the part accidents[quotient+2][1] because this is the greater indexed one. What does this mean? Well suppose that accidents is something like accidents = [[thing0, thing1], [thing2, thing3]] now say the … Read more

[Solved] i don’t know hot to use \n

I think the problem you are dealing with is you do not take input correctly. In your current approach, user has to pass a string(“”), and also print() is expecting a string to be printed out. So in order for your function to work, you need to modify your print() to print(name1 + “\n” + … Read more

[Solved] Merge Sort Python 2.7x

The issue is that with the line arr = ls + rs You are no longer calling merge on the list passed to merge_sort, but rather calling it on a copy. So the original list isn’t being modified. To correct this issue you can have the merge_sort function return arr at the end, then assign … Read more

[Solved] How to put an input in a function

You are never defining the function you’re trying to call. You’re printing from the function but never returning a value, thus your variable “a” will never get a value. Take a look at this, hopefully you’ll see where you went wrong: def odd(x): if int(x) % 2 == 0: return(“this number is even”) else: return(“this … Read more

[Solved] count total in a list python by split

That’s not a list. You are using a dictionary with key and value. Get the value, split on comma and find length using len. workdays = {‘work’: ‘5,6,8,10,13,14,15,18,20,22,24,25,28,30’} print(‘I have worked {} days’.format(len(workdays[‘work’].split(‘,’)))) Also, you could count the number of commas and add 1 to it to get the same result like so: print(‘I have … Read more