CS-IP Practicals 11th 11-15
CS-IP Practicals 11th 11-15
Note:
1. Each program should begin from a new page.
2. Write Aim, Algorithm, Program and Result on right side.(Ruled side)
3. Output should be on the left side. (Unruled side)
Index:
PROGRAM-11
Aim:
Write a python program to get the list of strings from the user and display the strings which start
with character ‘b’ or ‘B’.
Algorithm:
1. Start
2. Get a list from the user and save it in variable l.
3. Traverse the list using a for loop, access each string.
4. Check whether the first character of the string is ‘b’ or ‘B’. If so, then display the string.
5. Stop
Program:
Result:
Python program to get the list of strings from the user and display the strings which start with
character ‘b’ or ‘B’ is executed successfully and output is verified.
Output:
Algorithm:
1. Start
2. Get the no. of rows from the user and save it in a variable n.
3. Create a for loop with iterating variable ‘i’ and iterate it n times, execute lines 4 to 9.
4. Initialise variable a with value 65.
5. Display ' ' * (n – i +1).
6. Create a second for loop for columns, iterate it for range(row), execute lines 7 and 8.
7. Display the character A using chr(a). Set the end parameter of print to ' '.
8. Increment the value of a by 1.
9. Print a new line.
10. Stop
Program:
Result:
Python program to display the pattern is executed successfully and the output is verified.
Output:
PROGRAM: 13
Aim:
Write a python program to get a dictionary from the user which contains name as key, mark as
value and display the names which are having mark greater than 75.
Algorithm:
1. Start
2. Get the dictionary from user and save it in a variable ‘d’.
3. Create a for loop with iterating variable ‘i’ to access the values of the dictionary. Execute
line 4.
4. Check whether d[i] is greater than 75, if so display ‘i’.
5. Stop
Program:
Enter the dictionary: {'Arya' : 85, 'Cabel' : 45, 'Sunita' : 67, 'Abin' : 78}
Arya
Abin
PROGRAM: 14
Aim:
Write a python program to get a List containing two strings and check whether the strings are
anagram or not.
Algorithm:
1. Start
2. Get a list from the user and save it in L.
3. Sort the first and second element of the string and save it in variables m and n.
4. Check whether m and n are equal. If so, display strings are anagram.
5. Otherwise, display strings are not anagram.
6. Stop
Program:
Python program to get a List containing two strings and check whether the strings are anagram or
not is successfully executed and output is verified.
Output:
PROGRAM: 15
Aim:
Write a python program to get a List from the user, count the number of words which are having
length less than or equal to four and display the count.
Algorithm:
1. Start
2. Get a list from the user and save it in variable l.
3. Initialise a variable c as zero.
4. Traverse the list to access element using a for loop with iterating variable ’i’. Execute line
4.
5. Check whether the length of i is less than or equal to 4. If so, increment the value of c with
1.
6. Display the value of c.
7. Stop
Program:
Result:
Python program to get a List from the user, count the number of words which are having length
less than or equal to four and display the count is executed successfully and the output is verified.
Output:
Enter the list of strings: ['cast' , 'stack', 'cat', 'Grape', 'post' , 'Orchid', 'pet']
The count of words which have length less than or equal to 4 is: 4