Questions tagged [any]

"Any" means "at least one". Use this tag for questions that deal with testing elements in a collection to see if at least one of them passes a condition.

682 questions
-3
votes
2 answers

Why does Python's `any` function not return True or False?

If I try >>> from pylab import * >>> b = [2, 3, 4, 5, 6, 7] >>> a = any(x < 0 for x in b) >>> print(a) it doesn't return True or False. It returns at 0x7fbd62129ab0>
RUI YU
  • 51
  • 1
-3
votes
1 answer

How to add a none editable and dispalable original creator tag to a file

How to add a none editable and dispalable original creator tag to a file to prevent cheating in exams. I looking for a way, as it says, to stop cheating in exams. A way that the originators name, student/employee no or the like is added to the file…
-3
votes
1 answer

Most effective way of sorting arrya

What is the most effective way of sorting array in any language ? With lowest O() and P(). I find that shell sorting is one of the best way how to sort but is there something quicker?
magic-sudo
  • 1,206
  • 9
  • 15
-4
votes
1 answer

Invalid cast from type 'float' to type 'float*'

I'm trying to create an object that can be of any type. Here's the code: #include class thing { public: void *p; char type; thing(const char* x) { p=(char*)x; type=0; } thing(int x) { …
mrsimb
  • 1
  • 1
  • 2
-5
votes
1 answer

How to turn Any into Data

I want to save Any? in Swift (to FileManager). It could be everything, also types that don't conform to Codable (like SCNNodes). I would like to wrap it into Data. I know, I can't do it with a PropertyListEncoder. Could you make it easy for me to…
Michael
  • 185
  • 1
  • 11
-5
votes
1 answer

How to sort a vector?

Is it possible to sort vector by using std::sort or somehow else? I was trying to do smth like this vector va{ 55ll, 'a', -1}; sort(va.begin(), va.end(), [](const any& lhs, const any& rhs) { return…
-5
votes
5 answers

python any() works differently , why any([1,2]) in [1,3,5] returns True but not any(['a','b']) in ['a','v','x']?

any([1,2]) in [1,3,5] output is True which is right but any(['a','b']) in ['a','v','x'] gives False which is wrong ?? why this behavior in python.??
1 2 3
45
46