-
Notifications
You must be signed in to change notification settings - Fork 9
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 #11
Comments
False Work: |
The Boolean value is TRUE because: |
"spam" not in "spa span sparql" -> T |
@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. |
Indeed the comparisons with strings are alphabetical, but the one that comes first in a dictionary is lesser than the other. E.g.:
|
|
|
|
The answer is True: |
The boolean value is True:
|
TRUE: |
The boolean value is TRUE. So, we check the second one.
So, TRUE and TRUE= TRUE |
"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 ("egg">"span")? True and not (False) |
This expression returns the boolean value True |
"spam" not in "spa span sparql" and not ("egg" > "span"). |
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. |
"spam" not in "spa span sparql" and not ("egg" > "span") |
"spam" not in "spa span sparql" and not ("egg" > "span") True and not False |
The Boolean value is True. Here is the procedure:
True` |
"spam" not in "spa span sparql" and not ("egg" > "span") |
"spam" not in "spa span sparql" and not ("egg" > "span") |
What is the boolean value of
"spam" not in "spa span sparql" and not ("egg" > "span")
?The text was updated successfully, but these errors were encountered: