Python File readline() Method with Examples

How to Use the File readline() Method in Python In this tutorial, you’ll learn how to use the file readline() method in Python. The file readline() method reads and returns a single line from the file. Python File readline() Syntax The syntax of the file readline() method is as follows: file.readline() Remarks The readline() method reads a single line … Read more

Python sort() and sorted() with Examples

How to Use sort() and sorted() in Python In this tutorial, you’ll learn how to use the sort() list method and sorted() function in Python. Python lists have a built-in sort() method that can be used to sort a list in ascending, descending, or user-defined order.  Unlike sort(), sorted() is a built-in function that builds a new sorted list from … Read more

Python split() String Method with Examples

How to Use the Python split() String Method In this tutorial, you’ll learn how to use the Python split() string method. The split() splits a string and returns a list of strings. Python split() String Method Syntax The syntax of the Python split() method is as follows: split(separator [, maxsplit]) The split() Method Parameters separator: Optional. A string … Read more

Python replace() String Method with Examples

How to use the Python replace() String Method In this tutorial, you’ll learn how to use the replace() string method in Python. The replace() method returns a copy of the string with all occurrences of old substring replaced by a new substring. Python replace() Syntax The following illustrates the syntax of the replace() string method: string.replace(old_substring, new_substring [, count]) Method … Read more

MySQL NOW() Function with Examples

How to Use the MySQL NOW() Function In this tutorial, we’ll learn how to use the MySQL NOW() function. NOW() is a function to return the current date and time. MySQL NOW() Syntax The syntax of the NOW() function is as follows: NOW() Remarks The date and time is returned as “YYYY-MM-DD HH-MM-SS” Examples Example … Read more

MySQL CURRENT_DATE Function with Examples

How to Use the MySQL CURRENT_DATE Function In this tutorial, we’ll learn how to use the MySQL CURRENT_DATE function. The CURRENT_DATE function is used to return the current date. MySQL CURRENT_DATE Syntax The syntax of the CURRENT_DATE function is as follows: CURRENT_DATE() Remark This function is equal to the CURDATE() function. The date is returned … Read more

Python round() Function with Examples

How to Use the Python round() Function In this tutorial, you’ll learn how to use the Python round() function. The round() function returns a number rounded to a specified number of digits. Python round() Syntax The syntax of round() is as follows: round(number[, digits]) Parameters Number: Required. The number that you want to round. Digits: Optional. If … Read more

MySQL IF Statement with Examples

How to Use the MySQL IF Statement In this tutorial, you’ll learn how to use the MySQL IF statement. In MySQL, IF is a flow control statement and allows you to execute a block of SQL statements when a condition is TRUE, and execute a different block of SQL statements when the condition evaluates to FALSE. MySQL IF Syntax The … Read more

MySQL GROUP_CONCAT Function with Examples

How to Use the MySQL GROUP_CONCAT Function In this tutorial, you will learn how to use the MySQL GROUP_CONCAT function, which returns a string with concatenated values from a group and returns NULL if there are no non-NULL values. Learn more: Concatenate strings in MySQL GROUP BY clause in MySQL MySQL ORDER BY clause SELECT … Read more

Python find() String Method with Examples

How to Use the Python String find() Method In this tutorial, we’ll learn how to use the Python string find() method. The string find() method finds the first occurrence of a substring in a given string and returns the index of the substring if found. Python String find() Syntax: The syntax of the string find() … Read more

Python Variables – What are the Variables in Python?

Learn Variables in Python In this tutorial, you’ll learn what variables are in Python, how to create and assign values to them. What are the Variables in Python? In Python, variables used to store information and to be referenced and manipulated in the computer program. Python is an object-oriented and dynamic-typed programming language. Unlike other … Read more

Python Try Except – Exception Handling in Python

Exception Handling in Python Using Try and Except Statements In this tutorial, you’ll learn what exceptions are and how to handle exceptions in your Python programs using try and except statements.  In Python, the exception handling allows you to prevent the programs from crashing when something goes wrong during execution. What are Exceptions in Python? Python terminates and generates … Read more

Python any() Function with Examples

How to Use the Python any() Function In this tutorial, you will learn how to use the Python any() function, which returns True if any of the given iterable elements, such as a list, tuple, or dictionary, is True. Otherwise, it returns False. If the iterable is empty, any() returns False. Python sum() function Python … Read more

Python float() Function – Convert String to Float

How to Use the Python float() Function In this tutorial, you’ll learn how to use the float() function in Python. The float() function converts a number or string representing a number to a floating-point number. Python float() Function Syntax The syntax of the float() function is as follows: float(value) The float() Function Parameter value: A number or string … Read more

Python int() Function – Convert string to int

How to Use the Python int() Function with Examples In this tutorial, you’ll learn how to use the int() function in Python. Python int() converts a number or string (that is convertible) to an integer number. Python int() Function Syntax The syntax of the int() function is as follows: int(value=0, base=10) The int() Function Parameters value: A … Read more

Python reverse() and reversed() with Examples

How to Use reverse() and reversed() in Python In this tutorial, you’ll learn how to use the reverse() list method and reversed() function in Python. Python lists have a built-in method called reverse(). You can use it to reverse the elements of the list in place. There is also a built-in function called reversed() in Python. Unlike reverse(), the reversed() function takes … Read more

Python join() String Method with Examples

How to Use the join() String Method in Python In this tutorial, you’ll learn how to use the join() string method in Python. The join() string method returns a string, which is the concatenation of the elements in an iterable. It takes all items in the iterable and concatenates them, and returns the concatenated string. Python join() … Read more