Skip to main content

Posts

Showing posts with the label Object Oriented Programming

Q & A Chapter 1 | Python | Class 10 CBSE | Computer Application

Solutions of Computer Science with Python Class 10 A. Multiple Choice Questions(Tick the correct options) -  1. (d) 2. (c) 3. (b) 4. (a) 5. (b) 6. (b) 7. (c) 8. (a) 9. (a) 10. (a) B. Very short answer type questions - To exit from python editor press ctrl + z from keyboard or exit(). Operators are the symbols which perform the operation on some values. There are two types of operators Unary and Binary Operator. Python is available for free anybody can download and make programs in python. Also you can add or update modules or functions in python library. Tokens are smallest unit of a python program. Python breaks each lines into a sequence of meaningful component. Punctuators are symbols that are used in programming languages to organize sentence structures. The most common punctuators are ' " # C. Short Answers - Escape Sequence is a character that contains a special meaning. There are various types of escape sequence some of them are '\n...

Control Flow Statement in Python

Control Flow Statement in Python A computer always executes a program sequentially. It starts execution from the first statement and ends at the last statement. This order of execution of statement(s) is called Flow of Control . But if you want some statements to print after fulfilling some condition then this can be achieved by using the control flow statement . The control flow statement or control statements are used to control the flow of execution of the program. There are three different types of control flow statements in python: Sequential Decision making or selection Looping or iterative Sequential – Sequential execution of statements is the default behaviour of the program, in which it executes one line after another. Decision Making or Selection – Decision making statement is also called selection statement. Here, the execution of the statements depend upon the condition. Once the condition is fulfilled then the control of the flow will move accordingly....

Escape Sequence

What are Escape Sequence characters? Give example. Escape Sequence is a character that contains a special meaning. Escape Sequence Description \n New line \\ Backslash \’ Single quotation \” Double quotation \a Bell \b Backspace \r Carriage return \t Horizontal tab \v Vertical tab

Data types in Python

Data types in Python A data type represents the type of data stored into a variable or memory. There are five main data types : Numeric String List Tuple Dictionary Note – Variables are the address in the memory where the values are stored. We can treat variable like a container where you can put or store something. Numeric Data Type The numeric data types are used to represent numbers. There are three sub data types : int f loat complex Int data type The int data type represents an integer number. An integer number are a number without any decimal point or fraction part. For example 200, -100, 67, 100000, etc. Integer uses 4 bytes to store a value. It can range from -2147483648 to 2147483647. Float data type The float data type represents floating point numbers. A floating point number is a number that contains a decimal point. Like 3.14, 34.45, -45.678, etc. Float uses 8 bytes to store a value. It can range from 2.3E-308 to 1.7E+308. ...

Basic Structure of Python program

BASIC STRUCTURE OF A PYTHON PROGRAM #addition of two number a = 10 b = 20 c = a + b print(c) print(“Addition=“,c) #check greater number between two if a>b:   print(“The value of a is greater”) else:   print(“The value of b is greater”) Output:- 30 Addition=30 The value of b is greater Elements of the Program Comment  – The statement which is starting with # symbol is called comment line. This line is ignored by compiler. Statement  – A statement is an instruction that the python interpreter can execute. Expression  – Expression are the statement which is used for calculation in programming language. E.g. c = a + b is an expression where the addition of a and b is stored in c. Expressions are formed with operators and operands. Block or Suite  – A block or suite are a group of statements in a program like control flow statement and looping statement. Function  – The print() or input() function in pyt...

Tokens in Python

Tokens Tokens are smallest unit of a python program. As we see in chemistry a molecule are made up of combination of elements. Same as we compare in python programming the programs which we write in python are the molecules and the tokens are the elements of python. There are five types of tokens in python: Keywords Identifiers Literals Punctuators Operators Keywords Keywords are nothing but the reserved words which are used by python and have their specific meanings. We are not allowed to use keywords as variables in Python. Keywords in python are case sensitive. Some keywords in python are False, None, True, and, if, class, global, else, finally, for, not, etc. Identifiers Identifiers in python are nothing but user defined names to represent variables, functions, classes, etc. But there are few rules that we have to follow while defining an identifier: You can define the variable using letters (a to z), numbers (0 to 9) or an underscore (_). You cannot use di...

Installing Python

Installing Python Python is free to use, so anybody can download the python application for execution of program. You can download the latest version of python application from www.python.org . If this python executable file doesn’t install in you system then you can download Anaconda application for executing the python code. You have two mode or options for writing the code in python       a) Interactive mode       b) Scripting mode In an interactive mode you can run only single line or one block of code. It runs very quickly and gives the result instantly. Script mode is used when the user needs to write more than one line or block of code. It takes more time to compile. In this mode, one can simply write all the lines of code in a text file, but you have to save that file with .py extension. Writing a python program Python programs must be written in a specific structure. The syntax must be correct or the interpreter...

Introduction to Python

Python is a widely used interpreted, interactive, object-oriented and high-level programming language. It was created by Guido Van Rossum in February 20, 1991. Python is a very simple programming language so even if you are new to programming, you can learn python without facing any issues. The syntax of python program is as simple as like maths formula. Now let us learn some key points in the above statement: Interpretable or interpreted – The interpreter is used mostly for scripting languages like python, Visual Basic, Java, etc. which directly executes the code by converting it into an intermediate code (common code) usually called the byte code. This byte code is platform independent which can later be run on different platforms so the code is portable. Interactive – Python is an interactive language because you can see the output of the written command on the python prompt.  Object Oriented – Python supports Object-Oriented style or technique of programming that ...

Programming Language

Python Programming Today we will focus on the topic: Programming Language Programming language which consists of a set of instruction that produces various kinds of output. So, before starting this topic let us understand what language is: Language is a type of medium used for communication. If a person wants to say or order something then he must know any language like Hindi, English, Bengali, etc. same as we compare with the computer language we should also know the language of computer which are C, C++, Java, Visual Basic, Python, etc. to give the command to the computer as we know that the computer cannot run on its own. You must be knowing that the language of computer is divided into three parts:   Machine Language or Low Level Language Assembly Language or Middle Level Language High Level Language Machine language is a programming language consists of binary digit i.e. 0 and 1. The computer accepts and responds to this code simultaneousl...

Types of DBMS

Types of DBMS According to the structure the DBMS is divided into four categories: 1. Hierarchical Database 2. Network Database 3. Relational Database 4. Object-oriented Database 1. Hierarchical Database – In hierarchical database, records contain information about their groups of parent or child relationship just like as a tree. The structure implies that a record can have repeating information. 2. Network Database – A network databases are mainly used on large digital computers. A network database model is a database model that allows multiple records to be linked to the same owner file. The network database follows many to many relationship model, and because of many to many relationship model network database model can easily access any table record in the database. It is easier to navigate and search for information because of flexibility. It is suitable in complex data because of the multiple relationship founded among its data. 3. Relational Databas...