Tarun Chandra has Published 61 Articles

How to use a global variable in a Python function?

Tarun Chandra

Tarun Chandra

Updated on 31-Aug-2023 02:48:43

3K+ Views

There are 2 types of variables in Python namely Local variables and Global variables. Local variables mean the variables that are declared inside a function or inside a method whose impact or scope is only present inside that specific block and it doesn't affect the program outside that block. Global ... Read More

How to get a variable name as a string in Python?

Tarun Chandra

Tarun Chandra

Updated on 27-Aug-2023 12:23:18

27K+ Views

A string is a collection of characters stored as a single value. Unlike other technologies there is no need to explicitly declare strings in Python (for that matter any variable), you just need to assign strings to a literal this makes Python strings easy to use. In Python, a string ... Read More

How to check if a character is upper-case in Python?

Tarun Chandra

Tarun Chandra

Updated on 26-Aug-2023 03:47:56

35K+ Views

In this article, we are going to find out how to check if a character is an upper case in Python.. The first approach is by using the isupper() method. The Python standard library has a built-in method called isupper(). It supports the use of strings and other types of ... Read More

How to convert hex string into int in Python?

Tarun Chandra

Tarun Chandra

Updated on 24-Aug-2023 16:29:26

40K+ Views

A string is a group of characters that can be used to represent a single word or an entire phrase. Strings are simple to use in Python since they do not require explicit declaration and may be defined with or without a specifier. In Python, the class named string represents ... Read More

How to sort the letters in a string alphabetically in Python?

Tarun Chandra

Tarun Chandra

Updated on 07-Dec-2022 11:16:27

5K+ Views

In this article, we are going to find out how to sort the letters in a string alphabetically in Python. The first approach is by using sorted() and join() methods. We send a string as input and we get alphabetically sorted string as output. We need to send the string ... Read More

How to convert a string to a list of words in python?

Tarun Chandra

Tarun Chandra

Updated on 07-Dec-2022 11:12:24

8K+ Views

In this article, we are going to find out how to convert a string to a list of words in Python. The first approach is to use the built−in method split (). This function separates a text at the delimiter we specify. The delimiter parameter is sent to the split() ... Read More

How do I split a multi-line string into multiple lines?

Tarun Chandra

Tarun Chandra

Updated on 07-Dec-2022 10:29:59

5K+ Views

A string is a collection of characters that may be used to represent a single word or an entire phrase. Strings are useful in Python since they don't need to be declared explicitly and may be defined with or without a specifier. For dealing with and accessing strings, Python includes ... Read More

How do I remove a substring from the end of a string in Python?

Tarun Chandra

Tarun Chandra

Updated on 07-Dec-2022 10:26:24

980 Views

In this article, we are going to find out how to remove a substring from the end of a string in Python. The first approach is by using slicing approach. In this method, we will check if the string is ending with the given substring or not, if it is ... Read More

How can I tell if a string repeats itself in Python?

Tarun Chandra

Tarun Chandra

Updated on 07-Dec-2022 10:22:47

624 Views

In this article, we are going to find out how can we tell if a string repeats itself in Python. The first approach is by using slicing and find(). We want to see if the string we have is made up entirely of repeats of a substring of the string. ... Read More

How to do string concatenation without '+' operator in Python?

Tarun Chandra

Tarun Chandra

Updated on 07-Dec-2022 10:19:08

1K+ Views

In this article, we are going to find out how to do string concatenation without plus operator in Python. The first technique is utilizing the string inbuilt library's join() method. To mix strings with a separator, use this approach. This method produces a string sequence as output. Python's join() method ... Read More

1 2 3 4 5 ... 7 Next
Advertisements