Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lecture "Programming languages", exercise 2 #12

Open
essepuntato opened this issue Oct 21, 2021 · 20 comments
Open

Lecture "Programming languages", exercise 2 #12

essepuntato opened this issue Oct 21, 2021 · 20 comments
Labels

Comments

@essepuntato
Copy link
Contributor

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

@ghasempouri1984
Copy link

ghasempouri1984 commented Oct 22, 2021

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

@ManueleVeggi
Copy link

I think the solution is True. Indeed, “spam” in "spa span sparql" = F and “egg” > “span” = F. As a consequence, the question can be interpreted as following:

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

@tommasobattisti
Copy link

The value is True:

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

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

@federicabonifazi
Copy link

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

@OrsolaMBorrini
Copy link

The answer is: True

"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

@CarmenSantaniello
Copy link

The value is True, because spam not in "spa span sparql" = True and not ("egg" > "span") = not False
Then not False = True, so True and True = True.

@angstigone
Copy link

"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

@alt-manu
Copy link

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

Note, python uses unicode to compare strings and compares them character by character. Here, the unicode value of 'e from egg' is smaller than 's from span' as e comes before in the alphabets and in the unicode. It gives us the the result false which gets converted to true with the help of not operation.

now the final equation looks like : True and True = True.

Thus the final output will be True or 1

@Pablo751
Copy link

1)not 2)and 3)or

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

@olgagolgan
Copy link

the Boolean value is True

"spam" not in "spa span sparql" and not False = True

@elizastuglik
Copy link

The boolean value of "spam" not in "spa span sparql" and not ("egg" > "span") is True.

@giorgimariachiara
Copy link

The boolean value is True

@Bianca-LM
Copy link

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

@sotarega
Copy link

"spam" NOT IN "spa span sparql" and NOT ("egg" > "span")
TRUE and NOT (FALSE)   #because ""egg is lexicographically before "span", so should be “egg” < “span”  
TRUE and TRUE  
TRUE

@Postitisnt
Copy link

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

We have {True} and {not(False)} = {True} and {True} = {TRUE}

@chloeppd
Copy link

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

@martasoricetti
Copy link

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

@AmeliaLamargese
Copy link

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

@sanyuezoe
Copy link

"spam" not in "spa span sparqi"  ——> True
“egg">"span" ——> False
not False ——> True
True and True ——> True

@teragramgius
Copy link

"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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests