Computer notes for HSSC exam
BASIC OF
PYTHON LANGUAGE ( ONLY FOR HSSC CONCERN )
* Python is a high level
language. It is a free and open source language
*. Object oriented programming
* It is an interpreted language, as Python programs are executed by an
interpreter.
* Python programs are easy to understand as they have a clearly defined
syntax and relatively simple structure.
* Python is case-sensitive. For example, NUMBER and number are not same in
Python.
* We need Python shell for RUN and WRITE the program.
Working mode of Python
1 Interactive mode
2 script mode
1 Interactive mode
In interactive mode, on writing statement in
python, interpreter displays the results immediately.
On input immediately response the output
for example
>>>print”saraswati
academy”
Saraswati academy
>>> symbol is known as python prompt.
We another example
>>>x=10
>>>y=20
>>>x+y
30
Features of interactive
mode
1 This mode is good enough to learn, experiment.
2 this mode is good
enough to learn experiment or explore.
3 But we cannot save
the statements and have to retype all statement again and again.
Script mode
In this mode we first
type the program in a file , save it and then use interpreter to execute
the content of the file.
File name have
extension “.py “
It is use
for lengthy program, for saving the record further use.
Research and development.
Example
A=input(“enter 1st number)
B=input(“ enter 2nd number)
Print “quotient”, a/b
Python keyword:
* Keywords are reserved
words.
*Each keyword has a
specific meaning to the Python interpreter
*we can use a keyword in our program only for
the purpose for which it has been defined.
Example – false, true,
def,is, return, try, else , if , or, with lambda, for, while
etc.
Identifiers:
*Used to identify the variable,
function or other identities in program.
*The name should begin
with an uppercase or a lowercase alphabet or an underscore sign (_).
*This may be followed by
any combination of characters a–z, A–Z, 0–9 or underscore (_).
*Thus, an identifier
cannot start with a digit.
*It can be of any
length. (However, it is preferred to keep it short and meaningful).
*It should not be a
keyword or reserved word.
*We cannot use
special symbols like !, @, #, $, %, etc., in identifiers.
For example, to find the
average of marks obtained by a student in three subjects, we can choose the
identifiers as marks1, marks2, marks3 and avg rather than a, b, c, or A, B, C.
avg = (marks1 + marks2 + marks3)/3
*MOST COMMON
COMPUTER ABBREVIATION ASKED IN HSSC EXAM CLICK ON THE LINK.


1 Comments