Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Concatenation | Strings
Introduction to Python | Mobile-Friendly
course content

Kursinnhold

Introduction to Python | Mobile-Friendly

Introduction to Python | Mobile-Friendly

1. Python Basics
2. Variables
3. Strings

book
Concatenation

Great! Now you know how to store text in a variable. Now let's consider how we can operate with such variables.

First, let's consider the concatenation. This operation simply connects two strings into one. To concatenate two strings in Python, use the + operator (like in number addition).

Note that concatenation will not make additional blank spaces between addends.

For example, we can 'connect' words with the article.

123456
# Article and word article = "The" country = "Netherlands" # Output result of the concatenations print(article + country) print(article + " " + country) # Add blank space between
copy
question mark

What will the following code return after execution?

Select the correct answer

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 2

Spør AI

expand
ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

course content

Kursinnhold

Introduction to Python | Mobile-Friendly

Introduction to Python | Mobile-Friendly

1. Python Basics
2. Variables
3. Strings

book
Concatenation

Great! Now you know how to store text in a variable. Now let's consider how we can operate with such variables.

First, let's consider the concatenation. This operation simply connects two strings into one. To concatenate two strings in Python, use the + operator (like in number addition).

Note that concatenation will not make additional blank spaces between addends.

For example, we can 'connect' words with the article.

123456
# Article and word article = "The" country = "Netherlands" # Output result of the concatenations print(article + country) print(article + " " + country) # Add blank space between
copy
question mark

What will the following code return after execution?

Select the correct answer

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 2
Vi beklager at noe gikk galt. Hva skjedde?
some-alt