Introduction to Python Programming BY : DEEPESH NARANG { } ...
Table of contents INTRODUCTION AND BASICS PYTHON SYNTAX DATA TYPES AND VARIABLES PYTHON LIBRARIES AND FRAMEWORKS FILE HANDLING IN PYTHON REGISTRATION FORM 01 02 03 OVERVIEW : PYTHON FUNDAMENTALS PROJECT BASED LEARNING
OVERVIEW 01 { } .. ..
INTRODUCTION What is Python ? Python is a high –level interpreted programming language that is known for its simplicity , readability and versatality. It was created in the late 1980s by Guido van Rossum and had since become one of the most popular programming language. KEY FEATURES : Dynamic typing , automatic memory management, modularized , open - source *
BASIC CONCEPTS Variables are the placeholders of data. They must not be a keyword,start with numeric caharacter or a special symbol. input() : Used to get the input from the user. Can be type casted print() : < INPUT/OUTOUT > Variables { } *
Python Synatx Basics Practical EXERCISE 01 Exercise : Program To print the BMI( Body Mass Index) Height = float(input(“Enter your height in cm. ) Weight = float(input(“Enter your weight in kg.) BMI = Height/(Weight*Weight) float_BMI = float(BMI) print(f”Your BMI is {float_BMI} ) Expected Output : Enter your height in cm. 167 Enter your weight in kg. 75.2 Your BMI is 27.0 *
Concepts Learned In Python Indentation matters the most !!!! In python string and numeric data can be used together with ‘f’ character Type casting of variables using () paranthesis and data type outside . This returns the data type as class. Ex. Class <int> Indenatation Type Casting F - strings Type Checking
PYTHON FUNDAMENTALS 02 { } .. ..
It includes int,float,complex for numerical. It includes dict For creating dictionary . Here are PYTHON DATE TYPES : It includes str data type for textual data. It includes keyword ‘bool’ for representing true or false values . It indicates none data type. I t includes set, frozenset. TEXT NUMERIC MAPPING BOOLEAN NONE SET { } .. .. *
PYTHON LIBRARIES AND FRAMEWORKS The major difference between frameworks and libraries is complexity. Library offers fewer complexities but frameworks are opposite. Example of frameworks are : Django, Flask, Flask, CherryPy etc. Examples of Libraries are :TensorFlow, Numpy, keras, PyTorch etc. } ..
FILE HANDLING IN PYTHON Python provides several functions for creating, reading, updating and deleting files . The key functions for working with files are open(), read(), write() and close(). } ..
Practical Exercise 02 # Creating a text file with the command function ‘x’ : f = open(“myfile.txt”, “x”) # Inserting the string into the text file using write() method : file.write(“Hello There\n”) # Reading from a text file using read() method : f = open(“myfile.txt”, “x”) print(f.read()) *
A Picture Is Worth a Thousand Words
PROJECT BASED LEARNING 03 { } .. ..
REGISTRATION FORM Here In this section we are going to implement a Registration Form using Tkinter GUI method libraray and MYSQL Database. Tkinter is a Python library for developing GUI (Graphical User Interfaces). We use the Tkinter library for creating an application of UI (User Interface), to create Windows and all other graphical user interfaces. } ..
{ Here we have used Pycharm IDE and created our File . }
This is the code for creating table ‘user’ and importing modules .
CODE FOR THE GUI This is the Entire Source code for the GUI { } ...
OUTPUT This is the actual Registration form that will appear . { } ...
PYTHON GUI BASED Language PYTHON 2.x or 3.x recommended Version None Database Project Information *