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

Class XI

Here are the steps to swap two numbers without using a third variable: 1. Take input of two numbers in variables a and b 2. Add the two numbers (a + b) 3. Subtract one number from the sum (a + b - a) 4. Store it in the first variable (a = a + b - a) 5. Subtract the sum from the other number (b - (a + b)) 6. Store it in the second variable (b = b - (a + b)) This swaps the values of the two variables without using a third temporary variable.

Uploaded by

Ks
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
132 views

Class XI

Here are the steps to swap two numbers without using a third variable: 1. Take input of two numbers in variables a and b 2. Add the two numbers (a + b) 3. Subtract one number from the sum (a + b - a) 4. Store it in the first variable (a = a + b - a) 5. Subtract the sum from the other number (b - (a + b)) 6. Store it in the second variable (b = b - (a + b)) This swaps the values of the two variables without using a third temporary variable.

Uploaded by

Ks
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 68

CLASS – XII

INFORMATICS PRACTICES
2020-21
Total : 100 marks
Theory : 70 marks
Practical : 30 marks
TOPICS TO BE COVERED IN THEORY PORTION
1.Programming in Python 30
Introduction to python
Conditional and Looping Constructs in Python
Working with Strings
List, Tuples and Dictionary
NUMPY IN PYTHON
PANDAS
VISUAL DATA ANALYSIS
2.COMPUTER NETWORK 8
3.DATA MANAGEMENT(USING MYSQL) 25
4.Security cyber 7
Practical 30
File 5
Project 5
Exam 15
Viva 5
Python works in two
different mode interactive
and script mode
VIDEO
WRITE A PROGRAM TO OBTAIN
TWO NUMBER AND DISPLAY THEIR
SUM.
a=int(input("enter first number "))
b=int(input("enter second number "))
c=a+b
print("sum is ",c)

VIDEO
If we are not usingint method theninput
method will input as string not
As numeric and then it will join two numbers instead
of doing sum.

“4”+”5”= “45”
PRACTICE PROGRAM
QUES - WRITE A PROGRAM TO OBTAIN LENGTH AND
BREADTH OF THE RECTANGLE AND CALCULATE ITS
AREA AND PERIMETER.

l=int(input("enter length of the rectangle "))


b=int(input("enter breadth of the rectangle "))
ar = l* b
pr = 2*(l+b)
print("area is ",ar)
print("perimeter is ", pr)
PRACTICE PROGRAM

QUES - WRITE A PROGRAM TO OBTAIN A NUMBER FROM


THE USER AND THEN DISPLAY ITS NEXT FOUR
CONSECUTIVE NUMBERS AND THEIR SUM.

n=int(input("enter a number - "))


c1=n+1
c2=n+2
c3=n+3
c4=n+4
s=c1+c2+c3+c4+n
print("consecutive number 1 ",c1)
print("consecutive number 2 ",c2)
print("consecutive number 3 ",c3)
print("consecutive number 4 ",c4)
print("sum is ",s)
PRACTICE PROGRAM

QUES - WRITE A PROGRAM TO OBTAIN A PRINCIPAL ,


RATE OF INTEREST AND TIME AND THEN CALCULATE
SIMPLE INTEREST AND AMOUT.

p=float(input("enter value for principal "))


r=float(input("enter value for rate of intersert "))
t=float(input("enter value for time "))
si=(p*r*t)/100
amt=p+si
print("simple interset ",si)
print("amout is ",amt)
PRACTICE PROGRAM

QUES - WRITE A PROGRAM TO OBTAIN DIAMETER OF


THE CIRCLE AND CALCULATE ITS AREA.

d=float(input("enter value for diameter of a circle "))


r=d/2
ar=22/7*r*r
print("are of circle is ",ar)
PRACTICE PROGRAM

QUES - Write a Python program To find the area of a


triangle when base and height of a triangle are given.

b = float(input('Enter base of a triangle: '))


h = float(input('Enter height of a triangle: '))
area = (b * h) / 2
print('The area of the triangle is ', area)
PRACTICE PROGRAM
WAP TO OBTAIN BASIC SALARY OF AN EMPLOYEE AND THEN
CALCULATE ITS HOUSE RENT (12.5% OF SALARY), DAILY
ALLOWANCES(7.5% OF SALARY) TAX(2.5% OF SALARY) AND THEN
ALSO CALCULATE NET SALARY AS
BASIC SALARY + HOUSE RENT + DAILY ALLOWANCES – TAX.

bs=float(input("enter basic salary "))


hra=(bs*12.5)/100
da=(bs*7.5)/100
tax=(bs*2.5)/100
netsal=(bs+hra+da)-tax
print("house rent ",hra)
print("daily allowances ",da)
print("tax ",tax)
print("net salary ",netsal)
PRACTICE PROGRAM

WAP TO OBTAIN MARKS OF A STUDENT IN HIS FIVE


SUBJECTS AND THEN CALCULATE THE TOTAL MAKRS AND
PERCENTAGE.

m1=float(input("enter marks for subject 1 :- "))


m2=float(input("enter marks for subject 1 :- "))
m3=float(input("enter marks for subject 1 :- "))
m4=float(input("enter marks for subject 1 :- "))
m5=float(input("enter marks for subject 1 :- "))
s=m1+m2+m3+m4+m5
pr=(s/500)*100
print("total marks :- ",s)
print("percentage is :- ",pr)
PRACTICE PROGRAM
WAP TO OBTAIN ELECTRICITY UNITS CONSUMED BY A CUSTOMER
IN THE MONT OF MARCH AND APRIL AND RATE OF PER UNIT AND
DISPLAY THE TOTAL BILL TO BE PAID BY HIM

march=int(input("enter units consumed in march :- "))


april=int(input("enter units consumed in april :- "))
rate = int(input("enter rate per unit :- "))
unit = april-march
bill = unit*rate
print("total units consumed :- ",unit)
print("Bill to be paid :- ",bill)
PRACTICE PROGRAM
WAP TO INPUT SALES MADE BY THE SALESMAN IN 4 DIFFERENT
QUARTERS OF A YEAR AND THEN CALCULATE TOTAL SALES MADE
BY HIM AND ALSO CALCULATE COMMISSION EARNED BY HIM.
(COMMISSION % IS 3.5% OF THE TOTAL SAES)
q1=int(input("enter sales made in quarter 1 :- "))
q2=int(input("enter sales made in quarter 2 :- "))
q3=int(input("enter sales made in quarter 3 :- "))
q4=int(input("enter sales made in quarter 4 :- "))
total = q1+q2+q3+q4
comm = (total*3.5)/100
print("total sales made in a year ",total)
print("coommission earned ",comm)
FLOWCHART

A flowchart is simply a graphical representation


of steps. It shows steps in sequential order and
is widely used in presenting the flow of
algorithms, workflow or processes. Typically, a
flowchart shows the steps as boxes of various
kinds, and their order by connecting them with
arrows.
Flowchart
to
calculate
sum of
two
numbers.
FLOWCHART
TO
CALCULATE
SIMPLE
INTEREST
FLOWCHART
TO SWAP /
INTERCHANGE
TWO
NUMNERS
FLOWCHART
TO
CALCULATE
PERCENTAGE
OF THREE
SUBJECT
(MAX. MARKS
300)
FLOWCHA
RT TO
CHECK
WHETHER
THE
NUMBER IS
ODD OR
EVEN
Flowchart to
check whether
the given number
is positive or
negative
FLOWCHART TO MAXIMUM OF THREE NUMBERS
FLOWCHART
TO FIND THE
QUADRATIC
EQUATIONS
FLOWCHART TO FIND THE GRADES OF A
STUDENT BASED UPON THE FOLLOWING
CRITERIA
MARKS GRADE
>80 A
60-80 B
40-60 C
ELSE FAIL
Flowchart to
PRINT “HELLO
WORLD”
10 TIMES
FLOWCHART TO
FIND THE SUM OF
THE FIRST 10
NUMBERS
FLOWCHART TO
PRINT SUMM OF
ALL EVEN
NUMBER
BETWEEN 1 TO
N.
USE OF POW() AND SQRT() IN PYTHON
pow(x,y) : This function computes sqrt() function is an inbuilt function
x**y. This function first converts in Python programming language
its arguments into float and then that returns the square root of any
computes the power. number.

import math import math


r=math.pow(2,5) r=math.sqrt(144)
print(r) print(r)
PRACTICE PROGRAM
WAP TO OBTAIN THREE SIDES OF THE TRIANGLE AND THEN
CALCULATE ITS AREA.(Also Design The Flowchart For This)

import math
a=float(input("enter side 1 "))
b=float(input("enter side 2 "))
c=float(input("enter side 3 "))
s=(a+b+c)/2
k=s*(s-a)*(s-b)*(s-c)
area=math.sqrt(k)
print("area of triangle is ",area)
PRACTICE PROGRAM
WAP TO CALCULATE COMPUND INTEREST.(Also Design The Flowchart For This)

import math
principle=float(input("enter principle "))
rate=float(input("enter rate "))
time=float(input("enter time "))
ci = principle * (pow((1 + rate / 100), time))
print("Compound interest is", ci)
Q-1 WAP TO OBTAIN 2 NUMBERS FROM THE
USER AND INTERCHANGE THEIR VALUES.
Two ways of swapping
1.Using a third variable
2.Without using a third variable

You might also like