Algorithms for Python Lab Programs:
1a. Simple Interest
1. Start the program.
2. Prompt the user to enter the principal amount.
3. Prompt the user to enter the rate of interest.
4. Prompt the user to enter the time period (in years).
5. Apply the formula: SI = (Principal × Rate × Time) / 100.
6. Store the result in a variable.
7. Display the calculated simple interest to the user.
8. End the program.
1b. Temperature Conversion
1. Start the program.
2. Ask the user to input the temperature in Celsius.
3. Apply the formula: F = (C × 9/5) + 32.
4. Store the result in a variable.
5. Display the converted temperature in Fahrenheit.
6. End the program.
2a. Largest of Two Numbers
1. Start the program.
2. Ask the user to input the first number.
3. Ask the user to input the second number.
4. Compare the two numbers:
o If the first number is greater, display it as the largest.
o Else if the second number is greater, display it as the largest.
o Else, display that both numbers are equal.
5. End the program.
2b. Grade Calculator
1. Start the program.
2. Ask the user to input the marks obtained.
3. Check the marks against conditions:
o If marks ≥ 90 → Grade A.
o Else if marks ≥ 75 → Grade B.
o Else if marks ≥ 60 → Grade C.
o Else if marks ≥ 50 → Grade D.
o Else → Fail.
4. Display the grade.
5. End the program.
3a. Sum of First n Even Numbers
1. Start the program.
2. Ask the user to input n (number of even terms).
3. Initialize sum = 0.
4. Loop from i = 1 to n:
o Calculate the ith even number as 2 × i.
o Add it to sum.
5. After loop ends, display the total sum.
6. End the program.
3b. Factorial of a Number
1. Start the program.
2. Ask the user to input a number n.
3. Initialize factorial = 1.
4. Loop from i = 1 to n:
o Multiply factorial by i.
5. After loop ends, display the factorial of n.
6. End the program.
4a. Login Attempt Limiter
1. Start the program.
2. Set maximum attempts = 3.
3. Loop for each attempt:
o Ask the user to enter username and password.
o If both match the correct credentials → display “Login successful” and stop.
o Else → display “Invalid credentials”.
4. If all attempts are used and login fails → display “Account locked”.
5. End the program.
4b. Multiplication Table (1–5)
1. Start the program.
2. Loop i = 1 to 5:
o Print “Table of i”.
o Loop j = 1 to 10:
Print i × j.
3. End the program.
5a. Count Vowels in String
1. Start the program.
2. Ask the user to input a string.
3. Initialize count = 0.
4. For each character in the string:
o If it is a vowel (a, e, i, o, u in upper/lowercase) → increment count.
5. Display the total count of vowels.
6. End the program.
5b. Palindrome Check
1. Start the program.
2. Ask the user to input a string.
3. Reverse the string.
4. Compare original string with reversed string:
o If equal → display “Palindrome”.
o Else → display “Not a palindrome”.
5. End the program.