Skip to content
Advertisement

Tag: list

Hacker rank List Prepare

This is my Code and it gives me this error message. Why? Error Message – Traceback (most recent call last): File “/tmp/submission/20220617/03/45/hackerrank-3495035b4042c8bc0c55e799a2d2e687/code/Solution.py”, line 15, in l.sort() TypeError: ‘<‘ not supported between instances of ‘str’ and ‘int’ Answer You appended string value at x[0] == “append”. It should work when you change to l.append(int(x[1])

This Python code gives unwanted output when query_words if of size greater than 1

I’ve written some code, but it does not output what I expected. Here is the code: The expected final value of big_ds is: {123: {‘dollar’: [‘currency’], ‘probabilistic’: []}, 108: {‘dollar’: [], ‘probabilistic’: [‘probabilistic’]}} But the code sets the value of big_ds to the following: {123: {‘dollar’: [‘currency’], ‘probabilistic’: [‘currency’]}, 108: {‘dollar’: [‘probabilistic’], ‘probabilistic’: [‘probabilistic’]}} I asked a similar question a

Advertisement