python

computer scince and engineeringpython

python in Handling Exceptions try…except try…finally by unitdiploma

•Handling Exceptions •try…except •try…finally Errors and Exceptions Until now error messages haven’t been more than mentioned, but if you have tried out the examples you have probably seen some. There are (at least) two distinguishable kinds of Errors: syntax errors and exceptions.  while True print('Hello world')   File "", line 1 while True print('Hello world')                 ^ SyntaxError: invalid syntax •The parser repeats the offending line and displays a little ‘arrow’ pointing at the earliest point in the line where the error was detected. •The error is caused by (or at...
computer scince and engineeringpython

python in Data Hiding Method Overriding Polymorphism Method Overriding by unitdiploma

Data Hiding •Method Overriding •Polymorphism Method Overriding • We can provide some specific implementation of the parent class method in our child class. •When the parent class method is defined in the child class with some specific implementation, then the concept is called method overriding. •We may need to perform method overriding in the scenario where the different definition of a parent class method is needed in the child class. Example of Method Overriding class Animal:       def speak(self):           print("speaking")   class Dog(Animal):       def speak(self):           print("Barking")   d = Dog()   d.speak()   Output:  Barking...
computer scince and engineeringpython

bython in Constructor Destructor Inheritence in hindi by unitdiploma

•Constructor •Destructor •Inheritence Constructor •Constructors are generally used for instantiating an object. •The task of constructors is to initialize(assign values) to the data members of the class when an object of class is created. •In Python the __init__() method is called the constructor and is always called when an object is created. Syntax of constructor declaration :   def __init__(self):   # body of the constructor Types of Construtor default constructor •The default constructor is simple constructor which doesn’t accept any arguments. •It’s definition has only one argument which is a...
computer scince and engineeringpython

python Classes and Objects Encapsulation in hindi

•Classes and Objects •Encapsulation Class •The class can be defined as a collection of objects. •It is a logical entity that has some specific attributes and methods. •For example: if you have an employee class then it should contain an attribute and method, i.e. an email id, name, age, salary, etc. Example class ClassName:                        .            .               Example of Class class Test:     # A sample method      def fun(self):         print("Hello") # Driver code obj = Test() obj.fun() Object •The object is an entity that has state and behavior. •It may...
computer scince and engineeringpython

python in Object Oriented Programming Concepts by unitdiploma

•Object Oriented Programming Concepts Oops Concepts Like other general-purpose programming languages, Python is also an object-oriented language since its beginning. It allows us to develop applications using an Object-Oriented approach. In Python, we can easily create and use classes and objects. An object-oriented paradigm is to design the program using classes and objects. The object is related to real-word entities such as book, house, pencil, etc. The oops concept focuses on writing the reusable code. It is a widespread technique to solve the problem by creating objects. Major principles of...
computer scince and engineeringpython

python module in hindi by unitdiploma

Built-in ModulesImport statementPackagesDate and Time Module Python Module A python module can be defined as a python program file which contains a python code including python functions, class, or variables. In other words, we can say that our python code file saved with the extension (.py) is treated as the module. We may have a runnable code inside the python module. Modules in Python provides us the flexibility to organize the code in a logical way. To use the functionality of one module into another, we must have to import...
computer scince and engineeringpython

python File Handling in hindi

Introduction to File Handling •File Operations •Directories File Handling Files are named locations on disk to store related information. They are used to permanently store data in a non-volatile memory (e.g. hard disk). Since Random Access Memory (RAM) is volatile, we use files for future use of the data by permanently storing them.File handling provides a mechanism to store the output of a program in a file and to perform various operations on it. File Types Text files In this type of file, Each line of text is terminated with...
computer scince and engineeringpython

python Anonymous functions (Lambda Function) Recursive Functions with examples in hindi

Anonymous functions (Lambda Function) •Recursive Functions with examples Lambda Function •Anonymous function is a function that is defined without a name. •Anonymous functions are defined using the lambda keyword. •Therefore, anonymous functions are also called lambda functions. •The object returned by lambda is usually assigned to a variable or used as a part of other bigger functions. •Instead of the conventional def keyword used for creating functions, a lambda function is defined by using the lambda keyword.  Syntax:   lambda arguments: expression •This function can have any number of arguments but...
computer scince and engineeringpython

python Concept of Functions with Examples in hindi 

Advantages of Using Function Ease of Use: This allows ease in debugging the code and prone to less error.Reusability: It allows the user to reuse the functionality with a different interface without typing the whole program again.Ease of Maintenance: It helps in less collision at the time of working on modules, helping a team to work with proper collaboration while working on a large application. What is Function? A function can be defined as the organized block of reusable code which can be called whenever required. A function is a...
computer scince and engineeringpythonUncategorized

python Concept of String String manipulating & Indexing Creating String & Deleting String Various String Functions by unitdiploma

p Concept of String.String manipulating & IndexingCreating String &  Deleting StringVarious String Functions String Python string is the collection of the characters surrounded by single quotes, double quotes, or triple quotes. The computer does not understand the characters; internally, it stores manipulated character as the combination of the 0's and 1's. Each character is encoded in the ASCII or Unicode character. So we can say that Python strings are also called the collection of Unicode characters. In Python, strings can be created by enclosing the character or the sequence of...
1 2
Page 1 of 2