0% found this document useful (0 votes)
7 views

python

Library and information science notes on python

Uploaded by

molydey61
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

python

Library and information science notes on python

Uploaded by

molydey61
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

COMPUTER EDUCATION CLASS

1ne characters that we can't insert into a string are called Illegal characters, and these
Claracters modify the string. The function of escape sequences is to insert sucn characters
into the string without
modifying the string
Let us first see a simple
example:
Insertingsingle quotes into a string:
#without using \
1. string = 'Hi! 'man'
2. print ("Without using
\:", string)
Output:
string = 'Hi! 'man'

SyntaxError: invalid syntaX


Using the escapesequence:
#Using \'
1. string = 'Hi! \'man'
2. print ("By using\|:", string)
Output:
By using l: Hi! 'man

You can observe that our problem is now solved. Also, another solution in this
that we can use double quotes to enclose the string and use "'in
the string: situation is
1. string = "Hi!'man"
2. print ("By using\:", string)
Output:
By using \: Hi!'man
COMPUTER EDUCATION CLASS VIII

There are more escape sequences in Pythonthat helps the


of invalidstatements: programmer to print different types

Escape Use
character
Prints asingle quote inside a string enclosed with single quotes.
Prints a double quote inside a string enclosed with
\n Prints the succeeding part of \n even if in the same double-quotes.
line, in a new line
\t Gives a tab space equivalent to 8 normal
\r
spaces.
Brings the cursor to the starting of the line,called as 'carriage return."
\b Gives a backspace.
Creates an f-stringwhich is a whole new string formatting mechanism
\o00 Gives the octal representation
Prints a backslash character
\xhh Gives the hexadecimal representation

Simple program to add two numbers


# Python3program to add two numbers
num1 = 15
num2 = 12
# Adding two nos
Sum = num1 + num2
# printing values
print("Sum of",num1, "and", num2, "is", sum)

Output:
Sum of 15and 12 is 27

Adding two numbers with user input


# Python3 program to add two numbers
number1 = input("First number: ")
number2 = input("\nSecond number: ")
# Adding two numbers
# User might also enter float numbers

Page 55 of 68
COMPUTER EDUCATIONNCLASS VW

sum =float(number1) +
# Display the sum float(number2)
will print value in float
prin(The sum of {0} and {1} is (2".format(number1, numberZ, sum)
Output:
Firstnumber: 13.5 Second
The sum of 13.5 and 1.54 isnumber: 1.54
15.04

Find Maximum of two numbers in


# Python program to find the Python
# maximum of twO
numbers
def maximum(a, b):
if a >= b:
returna
else:
return b
# Driver code
a=2
b=4
print(maximum(a, b))

Output
4

Find Maximum oftwo numbers Using max) function


# Python program to find the
# maximum of two numbers
a= 2
b=4
maximum = max(a, b)
print(maximum)

Output
4

Page 56 of 68
COMPUTER EDUCATION CLASS VII

Lython Program to Find Area ofa Circle l0


#Python program to find Area of acircle
deffindArea(r):
Pl=3.142
return P* (r*r);

# Drivermethod
print("Area is %.6f" %findArea(5):

Output
Area is 78.550000

Python Program to Find Area of a Circle With Math library


circle
# Python program to find Area of a
#using inbuild library
import math
def area(r):
area =math.pi* powr2)
return print('Area of circle is:',area)
area(4)

Output
Area of circle is: 50.26548245743669

Python Program for simple interest


# Python3 program to find simple interest
# for given principal amount, time and
#rate of interest.
def simple_interest(p.t,r):
print(The principal is',p)
print("The time period is', t)
print("The rate of interest is',r)
si =(p*t* r)/100
print(The Simple Interest is', si)
return si
# Driver code
simple_interest(8, 6,8)

Output
Page 57 of 68
(OMPUTE

The prlnetpal a 0
Thettmeperlod tn 6
Tlhe rate of tnteront in
The Smple nterest n 4
Find Copound uterest witl1 Pytlion
l'ython program to fnd conpound
#Interest for given values,
def compound, nterest(prlnclpal, rate, tne)
# Caleulates compound Interes
Amount prlnclpal *(pow((l +rale/ 100),tme))
C= Amount prtnetpal
print("Compound tnterost la", C)
# Driver Code
compound interesl(10000, 10.26, B)
Output
Compound nterest ls 6200,940267774416

Multiple ChoiceQucstions (MCQs)


1,What is lython prlmarly used fo?
a)Video lditlng
b) 3D Modellng
c Web Development, Maclhlne learnlug, and
d) Musle Produetion Softwaro Industry
2. Wen WAs the lmplemenlatlo0n of l'ytho Alarte?
MDecennber 1999
b)Webruary 1991
c) Decennber 3, 2008
d) Late 1970#

3, Why was the uane "'ython" closen


for the
a) Named after a ake wecles
b)lusplred by a famousclreus anlmal
programmtnglangUage?
e) Guldovan Rossm' lavorlto
COMPUTER EDUCATION CLASS VIL

Glossary of terms
1. Terms Related to
Computer
Applications?
Applications, also called programs,use the platform to perform tasks.
Bit?
A bit is the smallest unit of information that a computer handles. A single bit can nold
one of two values, 0 or 1. only

Byte?
A
byte is a combination of eight bits arranged in sequence.
Camcorder?
A digital video camera used to record video.

Compact disc(CD) ?
A
storage device used to store data in a digital format.

Central Processing Unit (CPU)?


The central processing unit (CPU) is the primary hardware device that
the commands yougive to the computer:
interprets and uns

Commands?
A commandis an instruction, whnicn you Bve to a COmputer that
carried out. Commands are either typed by using a keyboard or are causes an action to he
chosen from a menu.
Communication Channel?
Acommunication channel is a path or alink that cornnects
such as printers and disk drives, to transfer information. computers or peripheral devices,
CPUspeed?
The CPUspeed is the rate at which the CPUcan
from RAM, or performinganumerical calculation. perform atask, such as
moving data to and

Page 60 of 68
COMPUTER EDUCATION CLASS VII

Data?
the Latin word datum, meaning an item of information.
pata isthe plural for
patabase Programs?
natabase programs are used to store and manage data in an organized way. You can also use
these programs to sort or search for information stored in a database.

Desktop?
The desktop is an on-Screen work area that uses a combination of menus and icons.

Desktop Computers?
Desktop computers are made up of individual components such as a monitor, a keyboard, a
system unit, and a printer.

Digital camera?
a flash memory card or a
A camera that stores images digitally on a memorydevice, such as
mini hard disk.

Digital versatile disc (DVD)?


digital format.
A storage device used to store data in a

Folder?
files in GUIinterfaces.
folder is a container for programsand
A

Gigabyte? approximately equal toone billion bytes.


One gigabyte (GB) is equal to 1,024 MB, which 1s

Graphical User Interface (GU)? to


graphical user ínterface (GUI) displays images and pictures that allow acomputer user
A
ínteract with a computer easily.

Graphics Programs? drawingS. YOu can also use these programs to


Graphicsprograms are used to create and eait
enhance photographs.

Hardware? components of a computer,


Hardware refers to all the physical

Page 61 of 68
COMPUTER EDUCATION
CLASS VIl
Home office?
Anarrangement that allows people to work from home.

Icon?
An icon is a small image displayed on the screen to represent an object.

Input Devices?
An input device is used to provide information to a computer. A
an input device. keyboard 1S an example of

Intranet?
A special type of network used to
organization. communicate and share information within an

Kilobyte?
One kilobyte (KB) is equal to
1,024 bytes.
Laptop Computers?
Laptop computers are lightweight and portable
also called notebook computers. personal computers. Laptop computers are
Local Area Network (LAN)?
ALAN connects
devices within a limited area, such as a
home or a smallgroup of offces
Megabyte?
One megabyte (MB) isequal to 1,024 KB.

MPEG Audio Layer 3 (MP3)?


Aformat developed by Motion Picture Expert Group to
allowe compression
for digital distribution. offaudio and video
Network?
A network is a group of computers that are connected to share
information. resources and
Network Drives?
exchange
A
network drive is a disk drive that is shared with other computers on a network
COMPUTER EDUCATION CLASS VIII

OperatingSystem?
ho onerating system controls the computer's hardware and provides services and access to
he hardware to programs. It also manages the computer's operations and tasks, such as
down.
logging on, logging off, and shutting

Personal digital assistant (PDA)?


Ahandheld computer that is used as a personal organizer. Atraditional PDA includes
features such as an address book, task list, and acalculator.

Pixels?
better the
Refers to small units that make up a picture. The higher the number of pixels, the
quality of the picture.

Programs?
executed by a computer. A program is
Aprogram is asequence of instructions that can be
also known as software.

Resolution?
Refers to the clarity and sharpness of a picture.

Server?
on a network that provides servicesto other computers on
The server is the main computer are allowed to access the hardware and
computers
the network. A server decides which
software on the network.

Setup Wizard?
Windows Vista. They guide the user through each step of a
Sotn igards are provided byhardware
installing orsoftware.,
particular task,such

Software?
sequence of instructions that a computer can execute. It is also referred to as
Software is a
programs.

SpreadsheetPrograms?
programs are used to create budgets, manage accounts, perform mathematical
Spreadsheet pr convert numerical data into charts and graphs.
calculations, and

Page 63 of 68
COMPUTER EDUCATION
CLASS VIl

Storage Devices?
Storage devices are used to store data. A hard disk is an example of a stOl a3

System Unit?
A System unit refers to the box that holds the nrocessor, motherboard, disk arives, power
supply, and the expansion bus.
Tablet Computer?
labiet computerS are computers that allow vou to write directly on the sCreen by using a
tablet pen.
Taskbar ?
The taskbar is a rectangular bar that is usually located at the
use the taskbar to select a bottom of the screen. rou can
program running on your computer.
Terabyte?
One terabyte is equal to1,024 GB,
approximately equal to trillion bytes.
Wallpaper?
Wallpaper is a pattern or picture on the screen background that you can
choose.
Wide Area Network (WAN)?
A
WAN is a network that connects devices in geographically separated areas.
Window?
In Windows Vista, a window is a
rectangular area on the monitor that displavs a nrogmon
Each program has its own window.

Word-processing Programs?
Word-processing programs are used to create and
modify text-based
Workstation?
documents.
Aworkstation refersto a computer connected to a network. You use a
the hardware and software on anetwork.
workstation to access

Page 64 of 68
COMPUTER EDUCATION CLASS VIII

2. Terms Related to Internet?

Add-ons?
Add-ons are programs that help you view files, such as animation, audio, or video,
included in Web pages. which are

Back Up?
Tomake a duplicate copy of aprogram, a disk, or data. The
duplicate copy is calleda backup.
Cache Memory?
Temporary memory on your computer that is sometimes used to store local copies of files
opened when you browse the Internet.

Computer Privacy ?
Keepinga user's data, including personal files and e-mail messages, such that the data is not
accessible by anyone without appropriate permission.

Computer Security ?
The protection ofa computer system and its data from accidental or intentional loss and
tampering.

Cookie ?
Asmall fle on a computer that is created when a user visits a Web site. AWeb site uses
cookies to identify users who visit the site, and also track the preferences of the users.

Copyright?
Amathod of protecting the rights of an orignatOr or a creative work, such as text, piece of
program, through law.
music, painting, or computer

E-commerce?
E-commerce refers to the business transactions made over the Internet, such as buying and
selling items online.

Page 65 of 68
COMPUTER EDUCATIONCLASS Vi

Electronic
The
mail (e-mail)?
exchange of text messages and
mail) is the
electronic computer files over the Internet.An electronic mail (e-
form of the traditional
messages and files over a network.
postal mail. E-mail allows you to exchange

Firewall?
A AIter that blocks unreliable
information from the Jnternet before it reaches you COpute
Or a private netWork. It provides additional
protection against threats
VIruses. 4 irewall also helps to ensure computer nriyacy hy restrictingsuch naukers and
as
any unauthorized user. external access by

Hacker?
h person whouses computer expertise to gain unauthorized access to a
computer, and tnen
misuses or tampers the programs and data stored on the
computer.
Hyperlinks?
Anelement in an electronic document that links to another place in the same
document or
to a diferent document. Generally, you clickon the hyperlink to follow the link. Hyperlinks
are the most necessary element in allhypertextsystems, including theWorld Wide Web.

Internet?
The Internet is aworldwide collection of public networks that are linked to each other for
information exchange.

Internet Service Provider (ISP)?


An ISP is a company that provides Internet connectiVity to individuals, businesses, and
organizations.

IP address?
An Internet Protocol (IP) addresS 1S a nunerie auaress that specifies the exact location ofa
computer on the Web.

ISP?
is
An Internet Service Provider (ISP) a company that provides Internet connectivity to
individuals, businesses, and organizations.

Page 66 of 68
COMPUTER EDUCATION CLASS VIII

Modem?

Amodemis a connection device that allows you to connect your computer to the Internet. It
Converts digital information into analog information and transmits it over a phone line.

Network?
Anetwork is a group of computers that are connected to share resources and exchange
information.

Password?
Aunique string of characters that a user types in as an identification code. It is a security
measure used to restrict access to computer systems and sensitive files.
Protocol?
Aprotocol is a standard method of transfering databetween different computers.
Search engine?
Asearch engine is a program that allows you to search and retrieve information over the
Internet.

Software Piracy?
Unauthorized copying of copyrighted software without obtaining the license or permission
of its copyright owner is software piracy.

Spam?
An irrelevant andunsolicited e-mail message sent by an unknown sender.A spam is sent to
distribute a message to many recipients at one time.

Spyware?
Acomputer program that is installed on your computer without your knowledge. Spyware
can secretly send out information about your Web browsing habits or other personal detaile
network.
to another computer through the

Username?
user is identified to a computer system or network. To
The name by which a access
by username and password, a user needs to
Computer protected
password.
enter the correct
combination of username and

Page 67 of 68
Universal serial bus (USB) cable?
Acable that helps you connect digital devices to a computer without turning oft the
computer.

Virus?

Acomputer program that is designed to cause malfunctioningof acomputer or damage the


data stored on the computer.

Worm?
Acomputer program that propagates itself across computers, usually by creating copies of
itself in each computer's memory. A worm might duplicate itself in one computer s0 often
that it causes the computer to crash.

The Web?
The Web, also known as the World Wide Web (WWwW., is a
collection of information that is
accessible on the Internet. This information is arranged logically
known as Web servers. and stored on computers
Web address?
A Web address specifies the protocol to be used for transferring data
computers and the exact location of the Web site. A Web between different
Uniform Resource Locator (ÜRL). address is also known as the

Web browser?
A Web browser is a program that enables you to view and interact
on the Web. with various resources
Web page?
A Web page is a formatted text document on the Web.

Web site?
A Web site is a collection of one or more Web pages that are
linked together
available through aWeb server. and made

You might also like