This content originally appeared on DEV Community and was authored by NJ
For Explanation watch the video
code ::
if __name__ == '__main__':
N = int(input())
L = []
for i in range(N):
cmd = input().split()
if cmd[0]=='insert':
L.insert(int(cmd[1]),int(cmd[2]))
elif cmd[0]=='print':
print(L)
elif cmd[0]=='remove':
L.remove(int(cmd[1]))
elif cmd[0]=='append':
L.append(int(cmd[1]))
elif cmd[0]=='sort':
L.sort()
elif cmd[0]=='pop':
L.pop()
elif cmd[0]=='reverse':
L.reverse()
This content originally appeared on DEV Community and was authored by NJ
Print
Share
Comment
Cite
Upload
Translate
Updates
There are no updates yet.
Click the Upload button above to add an update.
APA
MLA
NJ | Sciencx (2023-05-12T05:40:06+00:00) lists in python hackerrank solution. Retrieved from https://www.scien.cx/2023/05/12/lists-in-python-hackerrank-solution/
" » lists in python hackerrank solution." NJ | Sciencx - Friday May 12, 2023, https://www.scien.cx/2023/05/12/lists-in-python-hackerrank-solution/
HARVARDNJ | Sciencx Friday May 12, 2023 » lists in python hackerrank solution., viewed ,<https://www.scien.cx/2023/05/12/lists-in-python-hackerrank-solution/>
VANCOUVERNJ | Sciencx - » lists in python hackerrank solution. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/05/12/lists-in-python-hackerrank-solution/
CHICAGO" » lists in python hackerrank solution." NJ | Sciencx - Accessed . https://www.scien.cx/2023/05/12/lists-in-python-hackerrank-solution/
IEEE" » lists in python hackerrank solution." NJ | Sciencx [Online]. Available: https://www.scien.cx/2023/05/12/lists-in-python-hackerrank-solution/. [Accessed: ]
rf:citation » lists in python hackerrank solution | NJ | Sciencx | https://www.scien.cx/2023/05/12/lists-in-python-hackerrank-solution/ |
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.