shivajikobardan
Junior Member level 2
I know the answer, I need to use an OR gate because that is how the code works. I want to learn the problem solving part of this.
The code that works is:
Also and gate works if used differently. but I am unable to figure out the problem solving part of it. i.e figuring out how to decide what to use. that is what is confusing me. and this is very common thing in programming. very important as well.
I know the truth tables of OR and AND gate as well:
What are we expecting in output condition in this case?
I will explain it with a figure:
What is the condition we are expecting there? What is needed to be either true or false in output condition ? Can you clarify that much?
This is such a basic question but it is affecting my programming skills too much vividly. I am unable to figure out what condition are we trying to find in output?? I asked this question here as well, but didn't get my answer that I was trying to get.
The code that works is:
Python:
if(x<1 or x>10):
print("Error")
else:
print("Ok")
Also and gate works if used differently. but I am unable to figure out the problem solving part of it. i.e figuring out how to decide what to use. that is what is confusing me. and this is very common thing in programming. very important as well.
I know the truth tables of OR and AND gate as well:
What are we expecting in output condition in this case?
I will explain it with a figure:
What is the condition we are expecting there? What is needed to be either true or false in output condition ? Can you clarify that much?
This is such a basic question but it is affecting my programming skills too much vividly. I am unable to figure out what condition are we trying to find in output?? I asked this question here as well, but didn't get my answer that I was trying to get.
We want numbers that lie between 1 and 10 inclusive, why should I use OR gate instead of AND?
I know the answer, I need to use an OR gate because that is how the code works. I want to learn the problem solving part of this. The code that works is: if(x<1 or x>10): print("Error&
electronics.stackexchange.com
Last edited: