Could someone please tell us what is wrong with this question?😂 | Sololearn: Learn to code for FREE!

+15

Could someone please tell us what is wrong with this question?😂

https://www.sololearn.com/post/470210/?ref=app

7/19/2020 12:27:23 PM

MiKoLa🙏🇳🇬

11 Answers

New Answer

+11

MiKoLa🔥3L17.4L16.2.5k=>L18.🙏IDLE Answer might be same but people might not really know how it is really parsed and evaluated? 1 and 0 or 1 is parsed as (1 and 0) or 1 due to higher precedence of and lhs of or = (1 and 0) = 0 so you have 0 or 1 since lhs is 0 rhs is evaluated which gives 1 1 or 0 and 0 is parsed as 1 or (0 and 0) lhs of or = 1 and rhs = (0 and 0) due to higher precedence of and since lhs is 1, rhs is never evaluated and your final answer is 1

+8

Answer will be 1 only! Did you get it wrong? Ohhh!! Now I understood what you wanted to say!! If a person doesn't know that 4 is not less than 3, then also he/she can get the correct answer! 😂😂😂😂😂😂 ~ swim ~ Paul Jacobs he is not having a conceptual problem! He is just saying that both the cases will give the same output then what's the point of if else statement

+7

Namit Jain The example is simply checking the knowledge of logical "and" and "or" operator and their precedence. Rest everything is for confusion.

+7

~ swim ~ , here is my thought on the matter , please 🙏😂 https://code.sololearn.com/chf655aABoxS/?ref=app

+6

Yes, this question is going for else condition as 3 is less than 4 and condition under else will result in 1

+5

https://www.sololearn.com/learn/Python/2280/ 'and' goes before 'or'. Think that is part of the solution.

+4

madeline I think 'or' has more precedence than 'and' Sonu Kittu MiKoLa🔥3L17.4L16.2.5k=>L18.🙏IDLE already knows that 😅😅😂😂 See his profile! You will be impressed by his work!

+3

MiKoLa🔥3L17.4L16.2.5k=>L18.🙏IDLE Nothing wrong with the question. What do you think is wrong?

0

Answr will be one just remeber that order of evalution i.e "not and or " order of evaluation

0

☹️☹️☹️☹️☹️

0

This should be 0, I thinks so