Skip to main content

All Questions

Tagged with
2 votes
1 answer
47 views

Understanding Array comparison while using custom data types with numpy

i have a question regarding comparison with numpy arrays while using cusom data types. Here is my code: import numpy as np class Expr: def __add__(self, other): return Add(self, other) ...
Max Berktold's user avatar
0 votes
1 answer
45 views

Why I not am getting desired result while using == to compare elements of two SORTED arraylist [duplicate]

I want Make a new Arraylist of the common element from Two SORTED ARRAYLIST list1 and list2 I use "==" operator and got wrong answer the I used ".equals()" operator and got ...
Robot..'s user avatar
-1 votes
1 answer
780 views

When using IN_LIST in a CMake condition, getting "Unknown arguments specified"

Consider the following CMakeLists.txt file: cmake_minimum_required(VERSION 3.25.0 FATAL_ERROR) project(foo) set(my_list one two three) if ("two" IN_LIST ${my_list}) message("two is in ...
einpoklum's user avatar
  • 127k
-1 votes
1 answer
102 views

What's the benefit of 3-ways comparison operator (<=>) in C++20?

I know the syntax of it. I just wondering what's the benefit or whether does it make sens. Without it, we must code like this: void func1(int x, int y) { if( x > y ) doSomeThing(); ...
Leon's user avatar
  • 1,997
0 votes
1 answer
46 views

PHP bug or just a logical flaw

I need to know why, the real logical reason, that the following comparison is executing the "echo" line! It seems to be some kind of sorcery. If you take out the "+" sign, it won't ...
KonKarOtMa's user avatar
-1 votes
2 answers
55 views

Python 'and' operator: what will 'and' return when comparing two numbers? [duplicate]

print(45 and 2) What is the mechanism behind the result of 2?
tadams's user avatar
  • 1
0 votes
2 answers
640 views

A short python program

I am new to learning python and need to write two lines of code to get the result using comparison operators and not if blocks. Help would be greatly appreciated, thanks. Using one of the comparison ...
user avatar
1 vote
1 answer
30 views

php why does TRUE == "expired"?

This drove me nuts for a few hours. I have a function returning one of the three following values: function checkValid() { ... return array("expired",$oldDate,$newDate) ; return ...
rolinger's user avatar
  • 3,016
2 votes
1 answer
293 views

Powershell -eq operator

Why does the expression "1" -eq 1 comes TRUE in powershell ? The first one is of string type and the second one is of integer type why is it treating them as equal.
user60845's user avatar
-1 votes
1 answer
106 views

I need to check if a number is equal,2x,3x,4x,5x greater than the other. How can i do this?

Basically I just need this program to tell me that if a>b and by how much.So the conditions I need to check are if a==b, a>b,b<a and also I need to know how many times greater, which ranges ...
flowoverstack's user avatar
4 votes
1 answer
220 views

Simplify three way comparison a < b < c || b < c < a || c < a < b;

Is there a shorter way to compute this boolean expression? a < b < c || b < c < a || c < a < b In JavaScript this would be: a < b && b < c || b < c && c < ...
Steve Bennett's user avatar
1 vote
3 answers
2k views

Can someone explain this simple concept of null and undefined, more specifically single double & triple equals, or can you link the best explanation [duplicate]

How is null equal to undefined and not equal to undefined within the same operator. undefined == null true undefined !== null true undefined === null false undefined != null false
user avatar
0 votes
3 answers
3k views

What is a==b==c in C? [duplicate]

int main() { int a=0,b=0,c=0; if (a==b==c) { printf("111\n"); } else { printf("222\n"); } if (a==b) { printf("...
Milky酱TH's user avatar
-1 votes
1 answer
69 views

Cannot understand uncommon syntax [duplicate]

I have recently come across a function which calculates the day of the week for any given date. The function is shown below. unsigned int getDayOfWeek(const unsigned int day, const unsigned int month, ...
Tom Hudson's user avatar
1 vote
2 answers
874 views

C-Comparison with multiple variables in a if statement

Hi so i'm new at coding in C and i'd like to know how to compare several variables. Cause my if statement is only working for the first variable and ignore the ||. scanf("%d %c %d", &...
Overlord's user avatar

15 30 50 per page
1
2 3 4 5
10