python notes
# 1) Download Python IDLE from google and install it in your system.
# 2) Find IDLE from search bar in your system.
# 3) You will get Interactive mode.
# 4) Use Script mode(press ctrl+N after opened the Interactive mode)--
# --to make program in the Python.
# 5) Python is Case Sensitive Language.
# 6) input: To take input from the user.
# 7) Print : To take Output on the screen.
# 8) variables= store the values and can change during the execution.
# 9) Constent= Cannot change during the execution.
## DATA TYPES
# 1) string: Alphabatical letters or word is string.
# 2) Integer or Int: Any complete number is integer may be--
# ---its positive or negative e.g 15, 99, -13 etc.
# 3) Float : Any number with decimal is float number e.g 10.0 20.5 etc.
# 4) Boolean: Answer will be TRUE or FALSE.
# SYNTAX:
## OPERATOR & OPERANDS
#1) Operator & Operand : Operator are values and Operands are symbols.
#2) Assignment Operator: Assign the value with Assignment Operator.
Guido Van Rossum began doing its application-based
work in December of 1989 at Centrum Wiskunde & Informatica (CWI) which is
situated in the Netherlands.
It was initially designed by Guido van Rossum in 1991 developed
by Python Software Foundation.
The inspiration for the name came from BBC’s TV Show –
‘Monty Python’s Flying Circus’, as he was a big fan of the TV show and also he
wanted a short, unique and slightly mysterious name for his invention and hence
he named it Python!
1.
1. What is
python?
Python is a high-level, general-purpose, and interpreted programming
language.
Or
Python is a powerful and flexible high-level language.
2. What do you understand by Open-Source Language?
The term open source refers to any program whose source code is
made available for use or modification
3. Who was the
developer of Python and where it was developed?
Python was developed by Guido Van Rossum at CWI in Netherlands.
4. When python was developed?
Its implementation was started in December 1989. Its first stable
version was released in 1991.
5. How we can download the Python?
Python can be downloaded from its official website i.e., www.python.org/ download.
6. Why its name is python?
Python was named for the BBC TV show ‘Monty Python’s Flying Circus.’
7. What is the full form of GUI?
Graphical User Interface.
Python
features:
·
Free and Open Source. ...
·
Easy to code. ...
·
Object-Oriented Language. ...
·
GUI Programming Support. ...
·
High-Level Language. ...
·
Large Community Support. ...
·
Python is a Portable language.
...
8. How to start Python?
Go To search bar---à Type IDLE à click on it.
Or
Click Start Button-à Scroll down upto letter‘P’ from Menu list-à click on python
9. What is Python IDLE?
Python IDLE is a simple integrated Development Learning Environment.
10. What is the use of IDLE?
It allows the user to edit, run or browse the Python Code from single
interface.
11. How many modes in python/IDLE to work on it?
The two ways to work with python are: Interactive mode and Script Mode.
12. What is Python Shell?
Python’s interactive interpreter is called Python Shell.
13. What is the use of Interactive mode in python?
Interactive mode runs the Python commands directly on the command prompt
(>>>)
14. What is the use of script mode in python?
Script mode is used for creating Python code containing multiple set of
statements.
15. What is Machine Language?
Binary Language is known as Machine Language.
16. What is High Level language?
High level Language are the coding languages which are very close to the
user language.
17. What is low
level language?
A Low-level
computer language includes only 1’s and 0’s (Binary
language).
18. What is
Language Processor?
The language processor is a special translator
system that is used for turning a program written in a high language into
a machine code e.g Interpreter and compiler.
19. What is interpreter?
Python interpreter executes one instruction at a time.
20. What do you understand by Program in computer?
Set of instructions.
21. Difference between Program and Software?
A program is a piece of code or a set of instructions that performs a
given task whereas a software is a set of programs used to perform a task,
which is more complex than that of a program.
22. What is syntax?
The syntax means the set of rules that defines the way to write the
statements for the program.
23. What do you understand by case sensitive Python?
Python is known as a case-sensitive language because it differentiates
between uppercase(A) and lowercase(a) characters during execution.
24. What do you
understand by Extension of any file?
An extension typically
refers to file format. For example, the .doc or .docx extension specifies
a Microsoft Word document.
25. What
is the Extension of Python?
The
Extension of Python file is .PY
26. What is the meaning of execution in programming language?
When our program has been converted to machine language.
27. What
is the shortcut key to run/ execute the program in python?
The
shortcut key to run/ execute the program in python is F5.
28. What is Variable?
A variable is
a memory location that can hold values of a specific type used by the program
at the time of execution.
29. What is data
type?
Data Type
defines what type of data should be stored within the variable.
30. What do you
understand by OOP in python?
OOP is an object-oriented programming technique that combines
data and instructions for processing that data into an object that can be used
within the program. Object-oriented programming provides concepts that help
modelling complicated systems of real world into manageable software solutions.
31. What is
keyword in Python?
Keyword in a
Python language is a word which has specific meaning and is used for framing
statements e.g print etc.
32. How we can
change the string values to numeric values?
Int () and
float () functions are used to convert the number string values to numeric
values.
33. What is the
use of print () function?
Print ()
function helps to display the specific contents on the screen.
34. What is the
use of input () function?
Input () is used to collect the user given
input during the program execution. The input() function always accepts the
user input as text string.
35. What is
binding of variable?
The process
of assigning the value to a variable is known as binding of a variable.
36.
What is Integer
value in Python?
Int- This value is represented by int class. It contains
positive or negative whole numbers (without fractions or decimals). In Python,
there is no limit to how long an integer value can be.
37. What is Float value in Python?
Float – This value is represented by the float class. It is a
real number with a floating-point representation. It is specified by a decimal
point.
38. What is String Value in Python?
A string is a collection of one or more
characters put in a single quote, double-quote, or triple-quote.
39. what is Boolean in python?
It's used to represent the truth value of an
expression. For example, the expression 1 < 2 is True, while the expression
0 == 1 is False.
40. What is algorithm?
An algorithm is a step-by-step summary of the procedure,
41. What is Flow Chart?
A flowchart illustrates the steps of a program graphically.
42. what
is conditional statement in python
Fundamental programming constructs that allow you to
control the flow of your program based on conditions that you specify.
43. Types of conditional statements?
There are commonly three conditional statements: IF, IF-ELSE,
IF-ELIF-ELSE
IF Statement: ‘if’
statement creates a ‘true’ block whose statements are executed only if the
condition true.
IF Else: The
if-else statement is used to execute both the true part and the false part
of a given condition.
IF Elif Else: if-elif-else statements is
used in the situation where there are multiple conditions to check.
44. What is loop?
Looping means repeating something over and over until a particular
condition is satisfied.
Components of Iterative/ loop statements:
Initialization: To set the initial value of the control
variable.
Conditional Expression: To check whether the loop
is to be further executed or not.
Updation: To update the value of control
variable.
Loop Body: Set of commands which are to be
executed.
Types of loops.
For Loop: This looping construct is used to
repeat/ iterate a set of statements for a fixed number of times. That’s why it
is also known as ‘definite loop’.
Syntax of the ‘for’ loop is
for <control variable> in <sequence>
Python range () Function:
The range () function returns a sequence of numbers,
starting from 0 by default, and increments by 1 (by default), and stops before
a specified number.
Syntax: Range (start, stop, step)
While loop: Python While Loop is used to
execute a block of statements repeatedly until a given condition is satisfied/
true. i.e there is no fixed number for which the
loop will be executed. That’s why this loop is also known as indefinite loop.
Syntax: While <test expression>:
Statement(s)
Else:
Statement(s)
OOP is an object-oriented programming technique
that combines data and instructions for processing that data into an object
that can be used within the program. Object-oriented programming provides
concepts that help modelling complicated systems of real world into manageable
software solutions.
Description: OOP concepts are:
1) Objects: Objects are structures that contain
both data and procedures. For example, a student is an object which has name
and age,
2) Class: A class is a template that explains
the details of an object,
3) Inheritance: Inheritance is a technique to
re-use existing code again and again. Class that is inherited is called base
class and a class which it inherits is called derived class,
4) Polymorphism: Polymorphism means many, which
is requesting the same operation to perform differently,
5) Abstractions: It refers to displaying only
essential features of the application and covering the details, 6)
Encapsulation: It means wrapping the data and functions together into a class.
Examples of object-oriented languages are Java,
C++, PHP, C, Python etc.
Key features of object-oriented programming are:
· better programming designs
· emphasis on security and access
· reduction code duplication
· real world application is modelled well
Advantages of OOPs over procedure-oriented
programming (POP): With the help of OOPs, it will be easier for developing and
maintaining the software compared to POP. It will be difficult for the
procedure-oriented programming language when the code grows along with the
growth of the project size. Data hiding is enabled in the OOPs whereas the
global data could be accessed anywhere using the procedure-oriented programming
language. So this process is risky. Simulating the real world event effectively
is easier with OOPs. Thus, the real-word problem can be solved using this
method. The procedure-oriented programming language is less effective compared
to OOPs.
Comments
Post a Comment