Posts

TOKEN SEPARATION USING PYTHON

TOKEN SEPARATION USING PYTHON Token separation can also be called as Lexical Analyzer. Lexical Analyzer reads a input and separated it as identifiers , operators etc.  The code for token separation is given below. lex.py import re file = open("read.py") operators = {'=' : 'Assignment op','+' : 'Addition op','-' : 'Subtraction op','/' : 'Division op','*' : 'Multiplication op','<' : 'Lessthan op','>' : 'Greaterthan op' } operators_key = operators.keys() data_type = {'int' : 'integer type', 'float': 'Floating point' , 'char' : 'Character type', 'long' : 'long int' } data_type_key = data_type.keys() punctuation_symbol = { ':' : 'colon', ';' : 'semi-colon', '.' : 'dot' , ',' : 'comma' } punctuation_symbol_key = punctuat...

Tic Tac Toe Game using tkinter in Python

Image
TIC TAC TOE GAME USING TKINTER IN PYTHON INTRODUCTION: This is a mini project on the famous game which all the people in the world have played in their small age, the game is TIC TAC TOE. In olden ages we play the game in paper or notebook, but in this digital period everything has come into our electronic devices. Have we ever wondered how the game is designed in our electronic device, so in this I will show how we can create the game by coding it using python. BUTTONS: Python is a language which is user friendly, we can code in python by using common words. To print a statement we use the word ‘print’ and then followed by the statement. The main thing in tic tac toe game is that we need 9 buttons. The command to create a button is “button”  within button we can change the font of the button , size and many properties. The size of the button can also be changed. FUNCTION: In this program we are using two functions they are ‘play’ and ‘...

GUI Calculator using Tkinter in Python

GUI CALCULATOR USING TKINTER IN PYTHON INTRODUCTION: Calculator is used in everyday life. From the small calculation to the big calculation, calculator is used. Designing a calculator can be done in many ways, one way of designing is by using Python. I have explained all the procedures of designing a calculator using Python. BUTTONS : First we have to create 16 buttons, for creating buttons we are using the command which is given below, “button1 = Button(abc, text=' 1 ', fg='black', bg='white', command=lambda: press(1), height=5, width=10) button1.grid(row=2, column=0)” Using the word button a new button is created, ‘fg’ is for front colour and ‘bg’ is for background colour. ‘Height’ specifies the height of a button and ‘width’ specifies the width of the button. In grid we given the row and column where the button should be displayed. In the same way do it for 16 buttons FUNCTIONS: We have to create some functions...