Python 3 Script to Implement Half Subtractor in Digital Logic Full Example Project For Beginners

Python 3 Script to Implement Half Subtractor in Digital Logic Full Example Project For Beginners

 

Welcome folks today in this blog post we will be implementing half subtractor in digital logic in python. All the full source code of the application is shown below.

 

 

 

 

Get Started

 

 

 

In order to get started you need to make an app.py file and copy paste the following code

 

 

app.py

 

 

# Python program to implement Half subtractor

# Function to print Difference and Borrow
def getResult(A, B):

    # Calculating value of Difference
    Difference = A ^ B

    # Calculating value of Borrow
    # calculating not of A
    A = not(A)
    Borrow = A & B

    # printing the values
    print("Difference:", Difference)
    print("Borrow:", Borrow)


# Driver code
# Inputs A ,B
A = 0
B = 1

# passing two inputs of halfadder
# as arguements to get result function
getResult(A, B)

 

See also  Python 3 Tkinter Hotel or Restaurant Food Billing System Script GUI Desktop App Using Random Library Full Project For Beginners

 

Now if you execute the python script by typing the below command as shown below

 

 

python app.py

 

 

 

Leave a Reply