Code Monkey home page Code Monkey logo

Comments (17)

delfimpandiani avatar delfimpandiani commented on June 3, 2024 4

Mmmm.. I wonder if I got this wrong:

("spam" not in "spa span sparql") --> is "spam" not in "spa span sparql"? --> No = True

("egg" > "span") --> is "egg" bigger than "span" (is egg alphabetically bigger than span?) --> No = False

True and not (False)

True and True

True

from 2018-2019.

dersuchendee avatar dersuchendee commented on June 3, 2024 2

“Spam” not in “spa span sparql” = T

Not (“egg”>”span”)= F

T and F = F

from 2018-2019.

mangiafrangette avatar mangiafrangette commented on June 3, 2024 1

"spam" not in "spa span sparql" = True
and
not ("egg" > "span") = True
True and True = True

Note: I agree with @delfimpandiani: if "a string S1 is less than another string S2 if the former one precedes the latter one according to a pure alphabetic order" (Table 2, Programming languages lecture notes), I suppose that a string is greater than another string if the former follows the latter in alphabetical order, therefore "egg" > "span" = False because "egg" does not follow "span" in the alphabet.

from 2018-2019.

lisasiurina avatar lisasiurina commented on June 3, 2024 1

"spam" not in "spa span sparql" and not ("egg" > "span")

"spam" not in "spa span sparql" = True
not ("egg" > "span") = not False = True

True and True = True

from 2018-2019.

simayguzel avatar simayguzel commented on June 3, 2024 1

"spam" not in "spa span sparql" = True
("egg" > "span") = False --- not False = True
According to the Boolean value;
True and True = True

from 2018-2019.

federicabologna avatar federicabologna commented on June 3, 2024 1

"spam" not in "spa span sparql" and not ("egg" > "span")
True and not (False)
True and True
True

from 2018-2019.

EleonoraPeruch avatar EleonoraPeruch commented on June 3, 2024 1

ex 2 programming languages

from 2018-2019.

Totaro1996 avatar Totaro1996 commented on June 3, 2024 1

"spam" not in "spa span sparql" and not ("egg">"span")
T and not F
T and t
True

from 2018-2019.

tceron avatar tceron commented on June 3, 2024 1

"spam" not in "spa span sparql" and not ("egg" > "span")
True and not (False)
True and True
True

from 2018-2019.

MattiaSpadoni avatar MattiaSpadoni commented on June 3, 2024 1

"spam" not in "spa span sparql" and not ("egg" > "span")

  • I phase: brackets and first not don't influence each other so I can do them at the same time. Spam Is not in the string "spa span sparql" so "not" will return True. "Egg" is located before "span" so the operator "&gt" will return False (egg is "less" than "span")
    Result:
    True and not False

  • II phase: I have to do "not" before "and"
    Result:
    True and True

  • III phase: now I can do the last operation "And"
    result: True

from 2018-2019.

friendlynihilist avatar friendlynihilist commented on June 3, 2024 1

"spam" not in "spa span sparql" and not ("egg" > "span")
"spam" not in "spa span sparql" and not (False)
True and True
True

Again, we need to execute the operation contained in round brackets "egg" > "span". Alphabetically, e is not bigger than s (that is, it comes first in order) so the output is False. Then we resolve not operators and, finally, the and operator.

from 2018-2019.

ilsamoano avatar ilsamoano commented on June 3, 2024 1

What is the boolean value of ​"spam" not in "spa span sparql" and not ("egg" > "span")​?

"spam" not in "spa span sparql" and not (False) ​ >> "egg" should be less than "span"
true and not false
true

from 2018-2019.

SeverinJB avatar SeverinJB commented on June 3, 2024 1

Applied with strings, the logical operator > ("egg" > "span") uses the alphabetic order for the operation, e.g. "a" < "b" is true, because the letter "a" is listed before "b" in the alphabetic order. Based on this rule, the computation "egg" > "span" is false.

"spam" not in "spa span sparql" and not ("egg" > "span")
true and not(false)
true and true
true

from 2018-2019.

Saraa04 avatar Saraa04 commented on June 3, 2024 1

"spam" not in "spa span sparql" and not ("egg" > "span")

"spam" not in "spa span sparql" = True
not ("egg" > "span") = not (False)
True and not (False) = True and True
=> True

from 2018-2019.

DavideApolloni avatar DavideApolloni commented on June 3, 2024 1

"spam" not in "spa span sparql" and not ("egg" > "span")

"spam" not in "spa span sparql" --> true
("egg" > "span") --> false

true and not (false)
true and true
true

from 2018-2019.

HiImBono avatar HiImBono commented on June 3, 2024

Question

In the absence of round brackets, string operations have priority over boolean operations right? I was just wondering since "spam" not in "spa span sparql" is not between round brackets but ("egg" > "span") is. It does completely make sense to me if it works like this, otherwise you might have boolean operators operating on strings rather than booleans. If this is correct this would mean that the round brackets around ("egg" > "span") are redundant. Any body could confirm this by commenting the hooray on my question?

from 2018-2019.

essepuntato avatar essepuntato commented on June 3, 2024

@HiImBono

Answering your question, indeed all the comparisons will be executed before any other boolean operation.

from 2018-2019.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.