Python Project Final Report
Python Project Final Report
Submitted by:
Name Stuti Sharma Shanny Kumar Singh
Roll no RK21WYB47 RK21WYB74
Reg. no. 12112423 12213864
Section K21WY K21WY
Group 2 2
Submitted to:
Ms. Navpreet Rupal
ACKNOWLEDGEMENT
A bitwise AND takes two equal length binary representations and performs
the logical AND operation on each pair of the corresponding bits, which is
equivalent to multiplying them. Thus, if both bits in the compared position are
1, the bit in the resulting binary representation is 1 (1 × 1 = 1); otherwise, the
result is 0 (1 × 0 = 0 and 0 × 0 = 0).
MODE 4: Bitwise OR operation:
A Bitwise OR takes two bit patterns of equal length and performs the logical
inclusive or operation on each pair of corresponding bits. The result in each
position is 0 if both bits are 0, while otherwise the result is 1.
A Bitwise XOR takes two bit patterns of equal length and performs the logical
exclusive OR operation on each pair of corresponding bits. The result in each
position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if
both are 0 or both are 1. In this we perform the comparison of two bits, being 1
if the two bits are different, and 0 if they are the same.
Tools used:
1.Python 3.7.0:
Python is a general purpose programming language. Hence, you can use the
programming language for developing both desktop and web applications. Also,
you can use Python for developing complex scientific and numeric applications.
Python is designed with features to facilitate data analysis and visualization.
2.Tkinter:
Tkinter is Python's standard GUI (Graphical User Interface) package. Tkinter
is not the only GuiProgramming toolkit for Python. It is however the most
commonly used one.
OBJECTIVE
All computer systems need some form of user interface so that the computer and
human being can communicate. The most widely used type of interface for today's
computer systems is a graphical user interface, or GUI (pronounced as gooey).
A graphical user interface uses visual elements that present information stored
in a computer in an easy-to-understand manner. These elements make it easy for
people to work with and use computer software. A GUI uses windows, icons, and
menus to carry out commands, such as opening files, deleting files and moving
files. GUI software is much easier to use than command line software since there
is no need to type in and memorize individual commands.
Our project will be very helpful in calculating the result of bitwise operations. It
will save time as well as It will help people to dwell more into it as we have also
included the explaination tab in our project which will convert the given numbers
to binary and then decimal to display the result more clearly.
Repeated calculations significantly reduce interest in mathematics. Students tend
to get bored when classes are based on monotonously solving sheets and plagued
sheets of exercises. What if we do some different activity with the calculator as the
protagonist?
When the use of calculators is prohibited or reduced. They become tools
cherished and admired by students, who will end up considering them the best way
to solve a calculation. However, their daily use can cause students to doubt and
position themselves critically before them. ‘Will I have typed the numbers right?’
They will think.
GUI DESIGN
RESULT SCREENSHOT
1.FRONTEND DESIGN
5.EXPLAINATION OF RESULT
VARIOUS TERMS, TOOLS AND TERMINOLOGIES
USED IN THE CODE
Tkinter: It is the most commonly used library for developing GUI (Graphical
User Interface) in Python. It is a standard Python interface to the Tk GUI
toolkit shipped with Python. As Tk and Tkinter are available on most of the
Unix platforms as well as on the Windows system, developing GUI
applications with Tkinter becomes the fastest and easiest.
Entry widget :- The Entry widget is used to accept single-line text strings from a
user
Label widget:- The Label is used to specify the container box where we can
place the text or images. This widget is used to provide the message to the user
about other widgets used in the python application. There are the various
options which can be specified to configure the text or the part of the text shown
in the Label
Frame:- Python Tkinter Frame widget is used to organize the group of widgets.
It acts like a container which can be used to hold the other widgets
root = Tk()
root.title('Project')
root.geometry('800x600')
def display():
n = int(var.get())
a = int(e1.get())
b = int(e2.get())
m, t = 0, 0
str = ""
if (n == 1):
k = a & b
elif (n == 2):
k = a | b
elif (n == 3):
k = ~a
p = ~b
elif (n == 4):
k = a ^ b
if (n == 3):
m = k
t = p
stm = "%s" % m + ",%s" % t
myText.set(stm)
if (n in [1, 2, 4]):
m = k
myText.set(m)
def clear_all():
# whole content of entry boxes is deleted
e1.delete(0)
e2.delete(0, END)
# for deseleting radiobuttons
r1.deselect()
r2.deselect()
r3.deselect()
r4.deselect()
# To clear the content of a disabled field first we able it then we
delete it
e4.config(state=NORMAL)
e4.delete(0, END)
e4.config(state=DISABLED)
# setting focus on the first number entry field
e1.focus_set()
def exp_window():
newin = Toplevel(root)
newin.title("New Window")
newin.geometry("800x600")
def exit():
newin.destroy()
def calc2():
k, p = 0, 0
str1, str2 = "", ""
a = int(e1.get())
b = int(e2.get())
n = int(var.get())
no1.set(a)
no2.set(b)
bi1 = bin(a)
bi2 = bin(b)
binary1.set(bi1[2:])
binary2.set(bi2[2:])
if (n == 1):
op.set("AND")
k = a & b
elif (n == 2):
op.set("OR")
k = a | b
elif (n == 3):
op.set("NOT")
k = ~a
p = ~b
elif (n == 4):
op.set("XOR")
k = a ^ b
if (n == 3):
an1 = bin(k)
an2 = bin(p)
o1 = an1[3:]
o2 = an2[3:]
str1 = "%s," % o1, "%s" % o2
opans.set(str1)
str2 = "%s" % k, ",%s" % p
deci.set(str2)
if (n in [1, 2, 4]):
an = bin(k)
opans.set(an[2:])
deci.set(k)
no1 = StringVar()
no2 = StringVar()
binary1 = StringVar()
binary2 = StringVar()
op = StringVar()
opans = StringVar()
op.set("Operation")
deci = StringVar()
calc2()
exp = Frame(newin, height=600, width=800, bg='grey', cursor='cross')
num1 = Label(exp, text='Number 1', font=('courier', 20), fg='blue',
bg='yellow')
num1.place(x=120, y=100)
val1 = Entry(exp, textvariable=no1, state=DISABLED, width=5, fg='blue',
bg='white', font=('Arial', 20))
val1.place(x=250, y=100)
num2 = Label(exp, text='Number 2', font=('courier', 20), fg='blue',
bg='yellow')
num2.place(x=120, y=140)
val2 = Entry(exp, textvariable=no2, state=DISABLED, width=5, fg='blue',
bg='white', font=('Arial', 20))
val2.place(x=250, y=140)
bin1 = Label(exp, text='Binary 1', font=('courier', 20), fg='blue',
bg='yellow')
bin1.place(x=400, y=100)
val3 = Entry(exp, textvariable=binary1, state=DISABLED, width=10,
fg='blue', bg='white',
font=('Arial', 20))
val3.place(x=535, y=100)
bin2 = Label(exp, text='Binary 2', font=('courier', 20), fg='blue',
bg='yellow')
bin2.place(x=400, y=140)
val4 = Entry(exp, textvariable=binary2, state=DISABLED, width=10,
fg='blue', bg='white',
font=('Arial', 20))
val4.place(x=535, y=140)
op = Label(exp, text="", textvariable=op, state=DISABLED, width=8,
font=('courier', 20), fg='blue', bg='pink')
op.place(x=400, y=200)
op_val = Entry(exp, textvariable=opans, state=DISABLED, width=10,
fg='blue', bg='white',
font=('Arial', 20))
op_val.place(x=535, y=200)
dec_res = Label(exp, text='Decimal Result', font=('courier', 18),
fg='blue', bg='orange')
dec_res.place(x=250, y=300)
dec_val = Entry(exp, textvariable=deci, state=DISABLED, width=8,
fg='blue', bg='white', font=('Arial', 19))
dec_val.place(x=452, y=300)
exit_b = Button(exp, text='Exit', width=15, height=2, bg='green3',
fg='blue', activebackground='green',
activeforeground='red', command=exit)
exit_b.place(x=350, y=370)
exp.pack()
newin.mainloop()
var = IntVar()
r1 = Radiobutton(f, bg='pink', fg='green', font=('Georgia', 20),
text='AND', variable=var, value=1)
r1.place(x=150, y=170)
r2 = Radiobutton(f, bg='pink', fg='green', font=('Georgia', 20), text='OR',
variable=var, value=2)
r2.place(x=360, y=170)
r3 = Radiobutton(f, bg='pink', fg='green', font=('Georgia', 20),
text='NOT', variable=var, value=3)
r3.place(x=150, y=218)
r4 = Radiobutton(f, bg='pink', fg='green', font=('Georgia', 20),
text='XOR', variable=var, value=4)
r4.place(x=360, y=218)
myText = StringVar()
l3 = Label(f, text='Result is:', font=('courier', 20), fg='blue',
bg='yellow')
l3.place(x=150, y=390)
e4 = Entry(f, textvariable=myText, state=DISABLED, font=('courier', 20),
fg='black', bg='White')
e4.place(x=315, y=390)
https://www.tutorialspoint.com/python
http://in.youtube.com/
https://www.python.org
https://realpython.com
https://www.geeksforgeeks.org
https://www.w3schools.com
https://pythongeeks.org
https://www.askpython.com