Giter VIP home page Giter VIP logo

Comments (22)

essepuntato avatar essepuntato commented on August 27, 2024 2

@SarahTew @giorgiasampo

Indeed the comparisons with strings are alphabetical, but the one that comes first in a dictionary is lesser than the other. E.g.:

"this string" > "another string" is True since "t" (first character of the first string) is greater than "a"(first character of the second string)

from 2020-2021.

SarahTew avatar SarahTew commented on August 27, 2024 1

@giorgiasampo Thank you for your detailed explanation! I thought comparisons were purely just alphabetical by word (so whichever would come first in a dictionary was considered larger). Now I understand 👍

@essepuntato Thank you Professor Peroni. For anyone else that is confused about comparing strings I found this helpful explanation with a few simple exercises at the bottom to clear up the rules for comparing strings.

from 2020-2021.

SarahTew avatar SarahTew commented on August 27, 2024

False

Work:
True and not (True)
True and False
False

from 2020-2021.

giorgiasampo avatar giorgiasampo commented on August 27, 2024

The Boolean value is TRUE because:
-"spam" not in "spa span sparql" returns TRUE
-"egg"> "span" returns FALSE (I summed the values of the letters according to the alphabetical order so e=5, g=7, s=19, p=16, a=1, n=14 so egg=19 and span=50)
-not FALSE (result of previous operations) is TRUE
-TRUE and TRUE is TRUE

from 2020-2021.

edoardodalborgo avatar edoardodalborgo commented on August 27, 2024

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

from 2020-2021.

ChiaraCati avatar ChiaraCati commented on August 27, 2024

“spam” not in “spa span sparql” and not (“egg”>”span)
-> “spam” not in “spa span sparql” and not False [first solve the part in the brackets]
-> True and True [second step solve the not operations]
-> True [finally solve the and operation]

from 2020-2021.

fcagnola avatar fcagnola commented on August 27, 2024

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

from 2020-2021.

dbrembilla avatar dbrembilla commented on August 27, 2024

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

from 2020-2021.

vanessabonanno avatar vanessabonanno commented on August 27, 2024

The answer is True:
"spam" not in "spa span sparql" and not ("egg" > "span")
True and not False [("egg" > "span") is False because egg comes before (<) "span" in alphabet]
True and True
True

from 2020-2021.

AlessandraFa avatar AlessandraFa commented on August 27, 2024

The boolean value is True:

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

from 2020-2021.

gabrielefiorenza avatar gabrielefiorenza commented on August 27, 2024

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

from 2020-2021.

LuisAmmi avatar LuisAmmi commented on August 27, 2024

The boolean value is TRUE.
First of all, we analyze the first condition about the two strings "spam" and "spa span sparql".
"Spam" NOT in "spa span sparql" = TRUE

So, we check the second one.

  • NOT ("Egg"> "Span")
  • NOT (FALSE) --> because the first letter of "Egg" comes before "S" in the alphabet, so it's not "greater than" the second one.
  • TRUE

So, TRUE and TRUE= TRUE

from 2020-2021.

samuelespotti avatar samuelespotti commented on August 27, 2024

"spam" not in "spa span sparql" and not ("egg" > "span") => false because "s" is greater than "e" (I think I understand)
"spam" not in "spa span sparql" and not (False)
True and True
True

from 2020-2021.

GiuliaMenna avatar GiuliaMenna commented on August 27, 2024

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

True and not (False)
True and True = TRUE

from 2020-2021.

SusannaPinotti avatar SusannaPinotti commented on August 27, 2024

This expression returns the boolean value True

from 2020-2021.

yunglong28 avatar yunglong28 commented on August 27, 2024

"spam" not in "spa span sparql" and not ("egg" > "span").
"spam" not in "spa span "sparql" is TRUE. not("egg">"span") is TRUE ("egg" greater than "span" is false and with not TRUE)
TRUE and TRUE is TRUE
so TRUE

from 2020-2021.

laurentfintoni avatar laurentfintoni commented on August 27, 2024

The boolean value is True.

We solve the operation in () first. "egg" is not greater than "span" by alphabetical value, so the result is False. the first part is True ("spam" is not in the string). True and not False returns True.

from 2020-2021.

penelopelask avatar penelopelask commented on August 27, 2024

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

from 2020-2021.

lauratravaglini avatar lauratravaglini commented on August 27, 2024

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

True and not False
True and True
True

from 2020-2021.

AleRosae avatar AleRosae commented on August 27, 2024

The Boolean value is True. Here is the procedure:

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

"spam" not in "spa span sparql" -> True

True and not ("egg" > "span")

("egg" > "span") -> False because "e" comes before "s"

True and not (False)

True and True

True`

from 2020-2021.

IlaRoss avatar IlaRoss commented on August 27, 2024

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

from 2020-2021.

enri-ca avatar enri-ca commented on August 27, 2024

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

from 2020-2021.

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.