Python Lab – Algorithms & Flowcharts
IMPORTANT PYTHON LAB QUESTIONS – ALGORITHMS & FLOWCHARTS
1. Compound Interest
Algorithm:
1. Read P, R, T
2. CI = P*(1+R/100)^T – P
3. Print CI
Flowchart:
Start → Read P,R,T → Compute CI → Print CI → Stop
2. Triangle Pattern
Algorithm:
Loop i from 5 down to 1
Print i repeated i times
Flowchart:
Start → i=5 → Print i → i=i-1 → Repeat until i=1 → Stop
3. Character Type Check
Algorithm:
Read ch
If digit → print digit
Else if lowercase → print lowercase
Else if uppercase → print uppercase
Else → print special char
4. Prime Number Interval
Algorithm:
Read start, end
For each n in interval:
Check prime
If prime, print n
5. Common Values in Arrays
Algorithm:
Read A and B
For each element in A:
If element in B: add to result
Print result
6. Palindrome
Algorithm:
Read string s
Reverse s
If s == reversed: palindrome else not
7. Check Sorted List
Algorithm:
For each element:
If element > next: not sorted
Else sorted
8. Has Duplicates
Algorithm:
Create empty set S
For each element:
If in S: duplicate exists
Else add to S
9. Remove Duplicates
Algorithm:
Create new empty list
For each element:
If not in new list: add
Print new list