Python Practicals: Algorithms and Flowchart Descriptions
Practical 1: Sum All Items in a List
Algorithm
Start
Define list1 and list2
Sum all items in list1 and list2
Print the result
End
Flowchart Steps with Shapes
Start - Shape: Oval
Define list1 and list2 - Shape: Rectangle
Sum all items in list1 and list2 - Shape: Rectangle
Print the result - Shape: Parallelogram
End - Shape: Oval
Practical 2: Get the Largest Number from a List
Algorithm
Start
Input n (number of elements)
Initialize empty list a
Loop through n times:
Input element
Append to list a
Sort list a
Output the last element as the largest
End
Flowchart Steps with Shapes
Start - Shape: Oval
Input n (number of elements) - Shape: Parallelogram
Initialize empty list a - Shape: Rectangle
Loop through n times - Shape: Diamond
Input element - Shape: Parallelogram
Append to list a - Shape: Rectangle
Sort list a - Shape: Rectangle
Output the last element as the largest - Shape: Parallelogram
End - Shape: Oval
Practical 3: Count Strings with Same Start and End Characters
Algorithm
Start
Define words list
Initialize counter (ctr) to 0
Loop through each word in words:
Check if conditions are met (length > 1, first and last character are same)
If true, increment ctr
Output ctr
End
Flowchart Steps with Shapes
Start - Shape: Oval
Define words list - Shape: Rectangle
Initialize counter (ctr) to 0 - Shape: Rectangle
Loop through each word in words - Shape: Diamond
Check if conditions are met (length > 1, first and last character are same) - Shape:
Diamond
If true, increment ctr - Shape: Rectangle
Output ctr - Shape: Parallelogram
End - Shape: Oval