Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 224623

Python is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability. Use the python tag for all Python related questions. If you believe your question may be even more specific, you can include a version specific tag such as python-3.x.

1 vote

Check if two lists are permutations of the one another ( Improvement)

Just sort both lists and compare them: lst1=[5,1,0,2] lst2=[0,5,2,1] def comparelists(list1, list2): return(list1.sort()==list2.sort()) print(comparelists(lst1, lst2))
mti2935's user avatar
  • 145
1 vote

Check if array has the same number of even and odd values in Python

Here's a compact way of doing it, without using any loops or if statements. lst = [1,2,3,5,6,8,5,9,4,6] def balanced(lst): return(sum(map(lambda x: x%2, lst))==0.5*len(lst)) print(balanced(lst) …
mti2935's user avatar
  • 145