Can you edit a character in a string ?How do you change a string in python?

Posted on

Can you edit a character in a string ?How do you change a string in python?

If p=”nice”

how do I make “nice” into “Nice” ?

The answer is that strings are immutable, meaning they cant be changed.

so you would need to assign p to a a new string

p=”Nice”

cannot do p[0]=’N’

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s