Python Report 2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

TITLE OF PROJECT

Developing a GUI interface to perform bitwise AND, OR, NOT,


XOR operation on two decimal numbers with explanation
using python.

Course name: - PYTHON PROGRAMMING


Course code: - INT213
Submitted to: - DR.Upinder kaur

Submitted by: -
ROLL NAME REGISTRATION SECTION
NO:- NUMBER
1. ABHIRAM 11801535 K18KP

2. RAJYA 11801537 K18KP


LAKSHMI
3. JITENDRA 11805392 K18KP

4. MANDEEP 11803970 K18KP


KAUR
CONTENT: -

1. INTRODUCTION

2. OBJECTIVE

3. SCREENSHOTS

4. .ER DIAGRAM

5. CONCLUSION
Introduction:-
The project which is allocated to us is “develop a GUI interface performing bitwise And, Or,
Xor, Not operation on two decimal numbers with explanation using python”. We should use
the AND, OR, XOR, NOT operations in it.

A bitwise operator’s act on operands as if they were string of binary digits. It operates bit by
bit, hence the name.

There are following bitwise operators we used in this project are:-

1. & (Binary AND)


The operator copies a bit to the result. If it exists in both operands.
Truth table:-
A B o/p=A&B
0 0 0
0 1 0
1 0 0
1 1 1

2. | (binary OR)
It copies a bit. If it exists in either operand.
Truth table:-
A B o/p=A|B
0 0 0
0 1 1
1 0 1
1 1 1
3. ^ (Binary XOR)
It copies the bit. If it is set in one operand but not in both.
Truth table:-
A B o/p=A ^B
0 0 0
0 1 1
1 0 1
1 1 0
4. ~ (Bitwise NOT)
It performs logical negation on each bit, forming the one’s complement of the given
binary value. Bits that are 0 become 1, and those that are 1 become 0.
Truth table:-
A ~A
0 1 (vice versa 1 0)

BITWISE OPERATORS IN PYTHON

In the table below: let x = 10 (0000 1010 in binary) and y = 4(0000 0100 in
binary)
& BITWISE X& y = 0
AND (0000 0000)

| BITWISE X | y = 14
OR (0000 1110)

~ BITWISE ~x = -11
NOT (1111 0101)

^ BITWISE X ^ y = 14
XOR (0000 1110)
OBJECTIVES:-
In our project we should do that a function which takes input to perform like AND, OR,
XOR, NOT and then it shows the result and explanation for the given input code details.

A normal tkinter library is used to create an interface where user can provide inputs and
check the results.

The elaborations for tkinter library are:-

1. Radio buttons
2. Entry’s
3. Labels
4. Buttons
5. Loops and if else we used.

We used the 2 (two) no of functions.

Call back – to perform the operations and capture the results after the operations.

We provided the better explanation for the numbers given for the operations.

If we come to working of the code, the decimal numbers are given to perform operations
they were converted into binary and operations were performed on them.

As well as python provides the standard library Tkinter for creating the graphical user
interface for desktop based applications.

There are various widgets present in Tkinter. That is used to build the python GUI
applications.

We used the following widgets to create a user interface are:-

1. Button: - the button is used to add various kinds of buttons to the python application.

2. Entry: - the entry widget is used to display the single-line text field to the user. It is
commonly used to accept the user values.

3. Frame: - It can be defined as a container to which, another widget can be added and
organized.

4. Label: - A label is a text used to display some messages or information about the other
widgets.

5. Radio button: - the radio button is different from a check button. Here, the user is
provided with various options and the user can select o ly oe option among them.
6. Text: - it is different from Entry because it provides a multi-line text field to the user so
that the user can write the text and edit the text inside it.
These are the screen shots taken after the completion of creating a user interface to perform
the operations on operan
CONCLUSION:-

 So, we have studied the introduction about our project and came to know about
various bitwise operations.
 We have learnt the Bitwise operations in python.
 We came to know the truth table and examples of each bitwise operations performing
on operands.
 The objective of our project is performing bitwise operations on the user input
operands in the GUI interface.
 We used normal Tkinter library to create an interface where user can provide inputs
and check the results.
 Also, we have provided the better explanation for result as well as for the numbers
given for the operations.

You might also like