Write the following expressions using Python
x is a multiple of both 3 and 7
OPTIONS
1)x%3 and x % 7 == 0
2)x%3 == 0 or x % 7 == 0
3)X%3 == 0 and x % 7 == 0
4)X%3 or x % 7 == 0
Answers
Answered by
5
Answer:
option a is the correct answer mate !
Answered by
4
Answer:
option 3
Explanation:
Assuming that you mean x by "X" (since python is case sensitive)
Option 3 will be correct.
Let's analyse all options:
1) x%3 will return int datatype and x%7==0 will return Boolean. So there'll be no output.
2) It has uses OR gate which mean it will return True if 3 is divisible by either of those 2.
3) Checks for both cases, same datatype returned , AND gate used.
4) Once again wrong gate used.
Similar questions
Math,
1 day ago
Hindi,
3 days ago
Social Sciences,
3 days ago
Math,
7 months ago
Math,
7 months ago
Accountancy,
7 months ago