Skip to content
Advertisement

Hacker rank List Prepare

This is my Code and it gives me this error message. Why?

JavaScript

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’

Advertisement

Answer

You appended string value at x[0] == "append".

It should work when you change to l.append(int(x[1])

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement