0% found this document useful (0 votes)
99 views18 pages

Class IX

Uploaded by

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

Class IX

Uploaded by

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

Class IX

Python Practical Programs

Program 1:
Aim: Write a program to input two numbers and perform arithmetic
operations.

Algorithm:
Step 1: Input two numbers a and b
Step 2: sum= a+b
Step 3: difference=a-b
Step 4: Product=a*b
Step 5: division=a/b
Step 6: floor division=a//b
Step 7: modulus= a%b
Step 8: print sum, difference, product, division, floor division and
modulus
Step 9: Stop

Flowchart
Source Code:

Output:

Result: The program is executed successfully and got the output


Program 2:

Aim: Write a program to find the area and perimeter of square and
rectangle.

Algorithm:
Step 1: Input side of square
Step 2: Input length and breadth of rectangle
Step 3: area_square=side*side
Step 4: area_rectangle=length*breadth
Step 5:perimeter_sqaure=4*side
Step 5: perimeter_rectangle=2*(l+b)
Step 6:print area and perimeter of square and rectangle
Step 7: Stop

Flowchart
Source Code:

Output:

Result: The program is executed successfully and got the output


Program 3:

Aim- Write a program to input principal amount, rate of interest, time and
find the simple Interest

Algorithm:
Step 1: START
Step 2: Input principal, rate of interest, Time
Step 3:si=(p*r*t)/100
Step 4: print si
Step 5: STOP

Flowchart:
Source code:

Output

Result: The program is executed successfully and got the output


Program 4
Aim: Write a program to obtain temperature inn Celsius and convert it into
Fahrenheit using formula

Algorithm:
Step 1:START
Step 2: Input the temperature in Celsius.
Step 3: fahr=(cels*9/5)+32
Step 4: Print the temperature in Fahrenheit
Step 5: STOP

Flowchart:
Source Code:

Output:

Result: The program is executed successfully and got the output


Program 5

Aim: Write a program to input name and age from user and print if the user is
eligible to vote.

Algorithm
Step 1: START
Step 2: input name and age from user
Step 3: if age>=18
Step 4: print eligible to vote
Step 5: else print not eligible to vote
Step 6: STOP

Flowchart:
Source Code:

Output:

Result: The program is executed successfully and got the output


Program 6:

Aim: Write a program to check whether the given number is odd or even.

Algorithm:

Step 1: Input a number


Step 2: if num%2==0
Step 3: print number is even
Step 4: else print number is odd
Step 5: STOP

Flowchart:
Source Code:

Output:

Result: The program is executed successfully and got the output


Program 7

Aim: Write a program to display first 10 Natural numbers using for loop

Algorithm:
Step 1: Input a number
Step 2: count =1
Step 3:Is count<=10
Step 4: print count
Step 5: count=count+1
Step 6: STOP

Flowchart:
Source Code:

Output:

Result: The program is executed successfully and got the output


Program 8:

Aim: Write a program to find largest of two numbers using max() function in
python

Algorithm:
Step 1: START
Step 2: Input two numbers
Step 3: if x>=y
Step 4: print x is largest number
Step 5:else print y is largest
Step 6:STOP

Flowchart:
Source Code:

Output:

Result: The program is executed successfully and got the output


Program 9:
Aim: Write a program to input a string and traverse it using loop

Source Code:

Output:

Result: The program is executed successfully and got the output


Program 10:

Aim: Write s program to create a list and add an element to list using append()
function in python

Source Code:

Output:

Result: The program is executed successfully and got the output

You might also like