English, asked by Anshi102, 1 year ago

what is meant by string?

subject: python

Answers

Answered by lipsicasingh98
2
Strings are immutable. This means that once defined,they cannot be changed. Many pythons methods such as replace(),join() or split(), modify strins. However they do not modify the original string

divyanshisharma81: hi di
divyanshisharma81: sorry
divyanshisharma81: because I didn't go to on this aap
lipsicasingh98: hii
lipsicasingh98: its ok well
divyanshisharma81: Hlo
divyanshisharma81: di I am really sorry
divyanshisharma81: h r u
lipsicasingh98: fine babu
lipsicasingh98: its ok
Answered by fiercespartan
0

In simple terms, a string in python is anything that is either under the apostrophe(' ') or the quotations marks(" ").

This string can not be treated as a number, integer, float or Boolean.

Anything could be converted into a string by writing the command as:

str() And place anything inside of those brackets/parenthesis.

Now, I will be going over a few important string features.

Let's take a string. my_string = 'Hello there!'

Combining two string:

We simply use the symbol '+' to combine any number of strings.

Manipulating strings:

Let's say we have to change a few words in our string. What do we do? We first, take all the characters in a string and place them in a list.

In order to do that, we will say list(my_string). The output would look as follows:

['H','e','l','l','o',' ','t','h','e','r','e']

And now by manipulating this list, we can get our desired outcome.

Let's say we want to change the 'H' to 'L'. We simply say:

my_string[0] = 'L'

And then, if we want to print to word back again, we use this:

''.join(my_string) \

The output would be : Lello there!

If you want to see other list manipulations, I have answered a question earlier, please refer to that:

brainly.in/question/4046934

Similar questions