Introduction to Python

String variables and operations

So far we have done manipulations with numeric values but python provides many utilities to deal with textual values (strings) as well.
We can add two strings together, which will concatenate those two texts together. We can multiply a string by a number n, which will repeat that string n times, etc.
s1 = 'Hello world!'
s2 = 'My name is Anna'
s3 = s1 + s2
print(s3)       # Hello world!My name is Anna
print(s1 + s2)  # Hello world!My name is Anna
print(s1 * 3)   # Hello world!Hello world!Hello world!
print(s2 + '!') # My name is Anna!


Given two strings in the input, create a third one called total, which contains the two separated by a space, and print total in the output.
Hello My name is Bob
Hello My name is Bob


Time limit: 0.2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in