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
Function of an actuator
RSB [31]

Answer:

an actuator is a device that uses a form of power to convert a control signal into mechanical motion

6 0
3 years ago
Read 2 more answers
What is APR?
omeli [17]

Answer:

APR is the Interest rate advertised by lenders.

Explanation:

APR is the annual percentage rate that is different from the interest rate. Interest rate is the rate of borrowing money. While APR is the rate which includes interest rate, processing fee and other cost that are involved in loan approving.

This cost is decided by lender, which may be equal to interest rate or greater than interest rate.

5 0
3 years ago
PLS HURRY!!<br> Look at the image below
Crank

The output will be 10.

The while loop runs until numb is equal to or less than 13.

25 - 5 = 20

20 - 5 = 15

15 - 5 = 10, which is less than 13 so the loop stops and 10 is printed to the screen.  

4 0
3 years ago
1. Which raster image file type supports millions of colors and transparency?
Alona [7]

Answer:

PNG-24

Explanation:

6 0
3 years ago
In a ____, a single communication path connects the network server, departmental servers, workstations, and peripheral devices.
nevsk [136]
In a bus network, a single communication path connects the network server,departamental servers, workstations, and peripheral devices.
c. bus network
4 0
3 years ago
Other questions:
  • What was the impetus for corporations to begin entertainment broadcasting on radio?
    7·1 answer
  • ________ is digital textual information that can be stored, manipulated, and transmitted by electronic devices.
    7·1 answer
  • The syntax used for referencing cells with their worksheet names is the sheet name, followed by ____, then the usual column lett
    8·1 answer
  • _____ can be used to convert digitized documents into ASCII (American Standard Code for Information Interchange) text that can b
    11·1 answer
  • Why Is Jarvis Banned For Life? Literally Don't need to be forever!
    9·1 answer
  • Okay so remember that page I was advertising? At: fol ? Now it's deleted. And idk why because I was doing everything the right w
    7·1 answer
  • What does anyone who chooses to use speech recognition software need to do?
    5·1 answer
  • Consider the following code segment.
    12·1 answer
  • Who elso does their online school in their bed cause i do
    7·2 answers
  • What time is it NOW??
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!