Review of Python Basic and DFH (1)
Review of Python Basic and DFH (1)
CS PRACTICAL FILE
1|Page
16 Write a Python code to store ‘n’ number of 11
subjects in tuple.
17 To create a dictionary by passing nested list as 11
an argument to dict() function.
18 Program to perform linear search on a tuple of 12
numbers.
19 To create an empty dictionary, by assigning 12
two curly braces to a variable name:
20 WAP to input total number of section and 13
stream name in 11th class and display at
information on the output screen.
2|Page
Review of python basic
Practical Implementation-1
To define a simple function by using the command “def
func1():” and call the function.
Practical Implementation-2
To write a user-defined function to print a right-angled
triangle.
3|Page
Practical Implementation-3
To write a Python function to compute area of a rectangle.
******OUTPUT******
Practical Implemenation-4
Illustrating the concept of if statement, to determine
whether a person is eligible to vote.
******OUTPUT******
4|Page
Practical Implementation-5
Illustrating the concept of if statement, display the grade of
the topper in the class.
******OUTPUT******
Practical Implementation-6
Illustrating the concept of if-else statement.
******OUTPUT******
5|Page
Practical Implementation-7
Illustrating the concept of for loop statement.
******OUTPUT******
Practical Implementation-8
Illustrating the concept of for loop statement.
******OUTPUT******
6|Page
Practical Implementation-9
Program to generate the table of a number using for loop.
******OUTPUT******
Practical Implementation-10
To calculate and display the factorial of an inputted number.
******OUTPUT******
7|Page
Practical Implementation-11
Program to find the sum of the series:
S=1+x+x2+x3+x4…+xn
******OUTPUT******
Practical Implementation-12
Illustrating the concept of while loop statement.
******OUTPUT******
8|Page
Practical Implementation-13
WAP to second find the largest element in a list ‘NUM’.
******OUTPUT ******
9|Page
Practical Implementation-14
Give python code to accept values from the user up to a
certain limit entered by the user; if the number is even, then
add it to a list.
******OUTPUT******
Practical Implementation-15
Program to find absolute value of a number in Python.
******OUTPUT******
10 | P a g e
Practical Implementation-16
Write a Python code to store ‘n’ number of subjects in tuple.
******OUTPUT******
Practical Implementation-17
To create a dictionary by passing nested list as an argument
to dict() function.
A=[[1,”one”] , [2,”two”] , [3,”three’]]
>>>c=dict(a)
>>>c
{1:’one’,2:’two’,3:’three’}
11 | P a g e
Practical Implementation-18
Program to perform linear search on a tuple of numbers.
******OUTPUT******
Practical Implementation-19
To create an empty dictionary, by assigning two curly braces
to a variable name:
>>>d1 = ()
>>>type (d1)
<class ‘dict’>
12 | P a g e
Practical Implementation-20
WAP to input total number of section and stream name in
11th class and display at information on the output screen.
******OUTPUT******
13 | P a g e