procedure
procedure
a) FLOW CONTROL
Step 2: If n is 0 or 1, return 1.
1.b)FUNCTIONS
Step 2: Reverse the string s and store the result in variable rev.
Step 3: Compare the original string s with the reversed string rev.
Step 4: If the original string s is equal to the reversed string rev, return True (indicating it is a
palindrome). Otherwise, return False.
Step 5: Based on the return value, print "yes" if it is a palindrome or "no" if it is not.
1.C)STRING MANIPULATION
2.A)OPERATION ON LIST
Step 1:Create two lists: list1 containing mixed data types and list2 containing integers.
Step 2: Print the contents of list1 and list2.
Append the value 100 to list2 and print the updated list.
2.B)OPERATION ON TUPLE
3.OPERATION ON SET
4.OPERATION ON DICTIONARY
Step 5: Call the showDescription method on object c to display its initial description.
Change the color of the car by calling changeColor with the new color 'white'.
6.METHOD OVERLOADING
8.REGULAR EXPRESSION
Use re.search(pattern, text) to search for the defined pattern in the text.
Store the result in a variable named result.
9.MODULE CONCEPT
Step 2: Determine if the number n falls within the range defined by the lower limit a and
the upper limit b.
Step 3: Compare If n is within the range [a, b), proceed to the next step.
Step 4: Print a message stating whether the number n is in the range or out of the range.
10.PACKAGE PROGRAM
Import the function a() from module A, b() from module B, and c() from module C.
Call the functions A.a(), B.b(), and C.c() to print the respective messages "Hello from A",
"Hello from B", and "Hello from C".
11.EXCEPTION HANDLING
Step 1: Prompt the user to enter two numbers, a and b.
Step 2: Use an except block to catch a ZeroDivisionError and print an error message if the
second number is zero.
Step 3: Use an else block to print the result of the division if no exception occurred.
Step 5: Use a try block to attempt adding a number to a string. Catch the TypeError in an except
block and print the error message along with the exception details.