Work with Strings
Strings are the standard way to store text. We can use it for storing users' emails, names, etc. You can keep it in different ways.
- The first way is:
12string = 'Strings are easy' print(string)
- The second way is:
12string = "Strings are easy" print(string)
- The third way is:
1234string = ''' Strings are easy ''' print(string)
- The fourth way is:
1234string = """ Strings are easy """ print(string)
The first two ways are the most common, and the third and the fourth are used for storing several lines of code.
If you want to put a quotation mark inside the quotes, you can put an ordinary quotation mark inside a double one or vice versa.
1234string_1 = "I've never learned Python" string_2 = 'I"ve never learned Python' print(string_1) print(string_2)
Takk for tilbakemeldingene dine!
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Awesome!
Completion rate improved to 2.08
Work with Strings
Sveip for å vise menyen
Strings are the standard way to store text. We can use it for storing users' emails, names, etc. You can keep it in different ways.
- The first way is:
12string = 'Strings are easy' print(string)
- The second way is:
12string = "Strings are easy" print(string)
- The third way is:
1234string = ''' Strings are easy ''' print(string)
- The fourth way is:
1234string = """ Strings are easy """ print(string)
The first two ways are the most common, and the third and the fourth are used for storing several lines of code.
If you want to put a quotation mark inside the quotes, you can put an ordinary quotation mark inside a double one or vice versa.
1234string_1 = "I've never learned Python" string_2 = 'I"ve never learned Python' print(string_1) print(string_2)
Takk for tilbakemeldingene dine!