1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ilia_Sergeevich [38]
3 years ago
15

What does this mean in python?

Computers and Technology
1 answer:
scoundrel [369]3 years ago
8 0

the comments in the code should explain everything, brainly's formatting might be weird


gate = raw_input("Enter logic gate :").upper()#.upper() so lower/upper case of input doesn't matter

firstInput = raw_input("Enter first input :")#raw_input() for python 2.7, input() for 3

secondInput = raw_input("Enter second input :")

if (firstInput!="0" and firstInput!="1") or (secondInput!="0" and secondInput!="1"):

print("inputs must be 0 or 1")#ensure all inputs are in boolean range

quit()


firstInput=firstInput=="1"#convert "1" to true and "0" to false

secondInput=secondInput=="1"


if gate=="AND" or gate=="NAND":

result=firstInput and  secondInput

elif gate=="OR" or gate=="NOR":

result=firstInput or secondInput

elif gate=="XOR":

result=firstInput!=secondInput

else:#handle case of unknown/mistyped gates

print(gate+" is not known")

quit()

if gate=="NOR" or gate=="NAND":

result=not result#invert result for nor and nand

print("Result = "+str(int(result)))#uses int so 1/0 are printed instead of True/False


You might be interested in
A person clicks on an ad of a fitness club in a blog on nutrition. The person conducts a search on yoga and moves to another web
Sloan [31]

Answer: the answer is B.

hope this help

3 0
3 years ago
Using truth table, prove that:<br><br> (A + B). C = (A . C)+ (B .C) ?
Genrish500 [490]

Answer:

The image of truth table is attached.

Explanation:

In the truth table there is a separate table for the expression (A+B).C and for the expression (A.C)+(B.C) you can see in the truth table that the columns of (A+B).C is having same values as the (A.C)+(B.C).Hence we can conclude that (A+B).C is equal to (A.C)+(B.C).

4 0
3 years ago
How do u answer questions on brainly if ur on the app and on a phone. For me there is no answer button :(
Rudik [331]

Answer:

oh for me there is maybe try reloading?

Explanation:

8 0
2 years ago
Write a program that computes and displays a 15 percent tip when the
Anuta_ua [19.1K]
Your question wasn't very clear, but I think I understand what you want. Additionally, you should really state what language you're working with. Here it is in C#, and shouldn't be too much of a hassle to translate in to other languages.


Console.Write("Enter payment: ");

float payment;

if (float.TryParse(Console.ReadLine(), out payment))
    Console.WriteLine((Math.Floor(payment * 100) / 100) * 0.15, + " at 15% tip.");
else
    Console.WriteLine("Invalid input.");
5 0
3 years ago
Prompt
madam [21]

Have you ever tried to learn a new language or do you have friends who've had that experience?

Yes, I tried to learn Python and I even managed to do two Discord bots which are (somewhat) functional, but I'm far to say that I've managed to lean the language completly. There are lots of things to learn on a language as Python.

I also leant PHP on my own and managed to do a website (somehow) functional.

What are some of the  steps you would take to learn a new language, and what are some challenges that might arise?

The first steps in learning any computer language is learning the syntax. If you manage to do that, with the experience you gained from previous projects/languages you might be able to create something working. At times you might feel down if the project doesn't work as expected.

What are some things that  can help make the process easier?

Video tutorials, experiments and searching questions and problems on Google is a very important resource.

3 0
2 years ago
Other questions:
  • Design and write an object-oriented program for managing inventory bins in a warehouse. To do this you will use two classes: Inv
    5·1 answer
  • A(n) ____________ is a program that translates a high-level language program into a separate machine language program.
    7·1 answer
  • If you were given a 3D microscope to use for photography, which object(s) would you most want to photograph?
    10·2 answers
  • All ofthe following are correct EXCEPT one option when it comes towriting disappointing news letters. Identify theexception.
    6·1 answer
  • An interpreter _______. converts the procedural language one statement at a time converts the source code into machine language
    12·1 answer
  • Write a program that will input the names, ages and weights of three siblings and display the lightest followed by the youngest
    13·1 answer
  • sparse(compact) Description: A sparse matrix is a 2D matrix that has many zeros. Assume that for storage efficiency someone has
    9·1 answer
  • Plz hurry it’s timed
    5·1 answer
  • Write a HTML program as shown in the output.​
    9·1 answer
  • identify the difficulties with the k-nearest neighbor algorithm. a. both a and b b. calculate the distance of the test case from
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!