File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,7 +40,8 @@ def square(x):
4040
4141
4242
43- # Types of Decorators
43+ """Types of Decorators"""
44+
4445# 1. Function Decorators
4546# Function decorators are used to modify or enhance the behavior of functions.
4647def simple_decorator (func ):
@@ -86,7 +87,7 @@ def say_hello(self):
8687obj .say_hello ()
8788
8889
89- # Common Built-in Decorators in Python
90+ """ Common Built-in Decorators in Python"""
9091# @staticmethod
9192class MathOperations :
9293 @staticmethod
Original file line number Diff line number Diff line change 1616print (str4 .strip ()) # Remove leading and trailing spaces
1717print (str3 .replace ("Venkateswara" , "College" )) # Replace substring
1818print (str3 .split ()) # Split into a list of words
19- print (str3 .find ("a" )) # Find the index of a substring
19+ print (str3 .find ("a" )) # Find the first occurence index of a substring
2020print (str3 .index ("Venkateswara" )) # Find the index of a substring (raises error if not found)
2121print (str3 .count ("a" )) # Count occurrences of a character
2222print (str3 .startswith ("Ven" )) # Check if string starts with a substring
You can’t perform that action at this time.
0 commit comments