An Industrial Training Presentation on PYTHON PROGRAMMING At ……………… Submitted in partial fulfillment of the requirements for the award of the degree of ………………………… in …………………………… (Session 2021-2022) Submitted to - Submitted by- MR. XYZ BBBBBBBB Assistant Professor, Roll No. : OOOOOOOO (Department Of XXX) Batch : XXX DEPARTMENT …………………………………… ………………………..CLZ NAME……………………. UNI NAME…………………………………. SEPTEMBER , 2022
Content Training Introduction What is Python Why we use Python Data Types Conclusion References
What is Python Python is an interpreted, object-oriented, high-level programming language with dynamic semantics . Python's simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse.
Why We Use Python Large Standard Library Embedded Open source Object Oriented Language Interpreted Language Speed Easy Programming Language GUI Programming Support
Data Types Number String List Dictionary Touple Sets
Data Types NUMBERS – Integer Number Data Type Floating Number Data Type Complex Number Data Type DICTIONARY - A dictionary is a collection which is ordered, changeable and does not allow duplicates. Dictionary are used to store data value in key:value pairs. Ex. dict = {1: “a”,2:“b”}.
Data Types LIST – List is a collection of different values of different types of items. The item in the list are separated with the comma(,) and enclosed with the square brackets[]. a=[1,2,"sham","ram",21.5] STRING – Sequence of letters enclosed in quotes is called string or string literal or constant. Python supports both form of quotes i.e. ‘Hello’ , “Hello”
Data Types SETS - A type of array, which is unordered as well as unindexed. It doesn’t allow Duplicate members. Ex. Set1 = {“ram”, “shyam”} TUPLES – “t = (1,2,3,one)”. A simple immutable ordered sequence of items Items can be of mixed types, including collection types. .
Python Loops Python has two primitive loop commands: While loops For loops While loop - The while loop we can execute a set of statements as long as a condition is true. For loop - A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string). This is less like the for keyword in other programming languages, and works more like an iterator method as found in other object-orientated programming languages. With the for loop we can execute a set of statements, once for each item in a list, tuple, set etc.
Python Function A function is a block of code which only runs when it is called. You can pass data, known as parameters, into a function. A function can return data as a result. Python a function is defined using the def keyword Example : Def statements - def name_of_function(arg1,arg2): call ‘ name_of_function()’.
Conditional Statements ‘If - elif –else’ statements - If test expression: Body of if elif test expression: Body of elif else: Body of else ‘If – else’ statements - if test expression: Body of if else: Body of else - ‘ If’ statements - num = -1 if num > 0: print(num, "is a positive number.") print("This is also always printed.")
Python Operators Operators are special symbols in Python that carry out arithmetic or logical computation. The value that the operator operates on is called the operand. Example : >>>>2+3 5 Operators that Python Language supports are: Arithmetic Operators Assignment Operators Comparison Operators Logical Operators Identity Operators Membership Operators Bitwise Operators.
Errors and Exception Handling Errors :Errors are the problems in a program due to which the program will stop the execution. On the other hand, exceptions are raised when some internal events occur which changes the normal flow of the program. Two types of Error occurs in python. Syntax errors Logical errors (Exceptions) Exception handling : Python has many built-in exceptions that are raised when your program encounters an error (something in the program goes wrong) . When these exceptions occur, the Python interpreter stops the current process and passes it to the calling process until it is handled. If not handled, the program will crash.
Database Handling . The DBMS is a software system that enables you to create, store, modify, retrieve, and otherwise handle data from a database . Such systems also vary in size, ranging from small systems that simply run on your personal computer to larger ones running on mainframes. Establish a connection to your database of choice. Create a cursor to communicate with the data. Manipulate the data using SQL ( interact ). Tell the connection to either apply the SQL manipulations to the data and make them permanent ( commit ), or tell it to abort those manipulations ( rollback ), thus returning the data to the state before the interactions occurred. Close the connection to the database.
File Handling File handling is an important part of any web application. Python has several functions for creating, reading, updating, and deleting files. The key function for working with files in Python is the open() function. The open() function takes two parameters; filename , and mode . There are three different methods (modes) for opening a file: "r" - Read - Default value. Opens a file for reading, error if the file does not exist "a" - Append - Opens a file for appending, creates the file if it does not exist "w" - Write - Opens a file for writing, creates the file if it does not exist
Object Oriented Programming (OOP) OOP is basically very useful in future work. Basically, this is defined in to two categories Class and Object. Class: Class is a type of category of overall type. They can be a person, animal in other words it’s a broad. Object: From Class we get Object. These are instance of a class. Inheritance: In this concept, we have two types of class ‘Child Class’ and ‘Parent Class’. As we know in human the meaning of inheritance is obtaining the qualities, some effects or any other things child gain from their parents and from grandparents. Same in Python the Child Class inheritance the properties of Parent Class or functions of Parent Class. This is the very basic concept of Inheritance.
Conclusion Python supports both function-oriented and structure-oriented programming. It has features of dynamic memory management which can make use of computational resources efficiently. It is also compatible with all popular operating systems and platforms. Hence this language can be universally accepted by all programmers. • Implementation to develop Python based GUI Application • Directly interacted with OS using Python Programming.