append() This method is used to append an element to the list. Example: num_list=[1,2,3,4,5] num_list.append(6) print(num_list) Output: [1, 2, 3, 4, 5, 6] count() This method is used to count the number of times an element appears in the list. ...
vinish.ai Latest Articles
Built-In String Methods and Functions in Python
Shibucapitalize() This function is used to capitalize the first letter of the string. Example: str=”hello world” print(str.capitalize()) Output: Hello world count(str, beg, end) This function is used to count the number of times str occurs in a string. We can ...
Name of Module, Making our own modules in Python
ShibuName of Module Every module has a name. We can find the name of a module by using the __name__attribute of the module. Actually, for every standalone program written by the user, the name of the module is _main_. Example: ...
Modules in Python
ShibuIn Python, modules are pre-written pieces of code that are used to perform common tasks like generating random numbers, performing mathematical operations, etc. It allows us to reuse one or more functions in a program, even in the programs in ...
Recursive Function in Python
ShibuIn Python, a recursive function is defined as a function that calls itself to solve a smaller version of its task until a final call is made, which does not require a call to itself. Every recursive solution has two ...
Lambda Function in Python
ShibuLambda functions are throw-away functions, i.e., they are just needed; they have been created and can be used anywhere a function is required. Lambda functions are so-called because they are not declared as other functions using the keyword def. They ...
Defining Function in Python
ShibuFunction definition with required arguments: For required arguments, the arguments are passed to a function in correct positional order. Also, the number of arguments in the function call is exactly matched with the number of arguments specified in the function ...
Variable scope and Lifetime in Python
ShibuIn Python, we cannot just access any variable from any part of our program. Some of the variables may not even exist for the entire duration of the program. In which part of the program we can access a variable ...
Function in Python
ShibuIn Python, a function is a block of organized and reusable program code that performs a single, specific, and well-defined task. Every function encapsulates a set of operations, and when called, it returns the information to the calling program. Python ...
Pass statement in Python
ShibuIn Python, the pass statement is used when a statement is required syntactically, but no command or code must be executed. It specifies a null operation or simply No Operation statement. Nothing happens when the pass statement is executed. Actually, ...