techhub.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
A hub primarily for passionate technologists, but everyone is welcome

Administered by:

Server stats:

4.6K
active users

#PythonQuestion

0 posts0 participants0 posts today
Scott Miller 🇺🇦 🇺🇸<p>Python Question: Is there an efficient way to see if every element in an iterable is equal to a user-specified value?</p><p>The best idea I've seen so far is to use a list comprehension to check for equality, and then use the all function, like this:<br> MyList = [1,1,1,1,1,1,1]<br> all((x==1 for x in MyList))</p><p>That's readable and probably not bad performance. Is there something better?</p><p><a href="https://mstdn.social/tags/Python" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Python</span></a> <a href="https://mstdn.social/tags/PythonQuestion" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>PythonQuestion</span></a></p>
RecursiveNeuron :verified:<p>Python quiz</p><p>What is the result</p><p>A. Invalid syntax, should use &#39;if&#39; for condition<br />B. [80,73,82,64]<br />C. [True, True, True, True, False]<br />D. [80]</p><p><a href="https://techhub.social/tags/pythonquestion" class="mention hashtag" rel="tag">#<span>pythonquestion</span></a> <a href="https://techhub.social/tags/python" class="mention hashtag" rel="tag">#<span>python</span></a> <a href="https://techhub.social/tags/python3" class="mention hashtag" rel="tag">#<span>python3</span></a> <a href="https://techhub.social/tags/pythonquiz" class="mention hashtag" rel="tag">#<span>pythonquiz</span></a> <a href="https://techhub.social/tags/programmers" class="mention hashtag" rel="tag">#<span>programmers</span></a></p>
RecursiveNeuron :verified:<p>Python quiz</p><p>What is the answer?</p><p><a href="https://techhub.social/tags/pythonprogramming" class="mention hashtag" rel="tag">#<span>pythonprogramming</span></a> <a href="https://techhub.social/tags/Python" class="mention hashtag" rel="tag">#<span>Python</span></a> <a href="https://techhub.social/tags/Python3" class="mention hashtag" rel="tag">#<span>Python3</span></a> <a href="https://techhub.social/tags/PythonQuestion" class="mention hashtag" rel="tag">#<span>PythonQuestion</span></a> <a href="https://techhub.social/tags/programming" class="mention hashtag" rel="tag">#<span>programming</span></a></p>