Lesson 1, Topic 3
In Progress

Introduction To Python Strings

Lesson Progress
0% Complete

Code of the Lesson

Examples of strings:

'A'
'Python'
'Python was released in 1991'
'0123456789  @#$&+-/*=  !?:;-,.'

Print strings to the output window:

print('A')
print('Python')
print('Python was released in 1991')
print('0123456789  @#$&+-/*=  !?:;-,.')

Note: To make a vertical selection in the code editor, hold the Alt key on your keyboard while pressing the left button of your mouse.

The empty string is written as two consecutive quotes:

''

String concatenation without spaces between the strings:

print('Hello' + 'Python.')
print('Coding' + 'is' + 'really' + 'fun!')
print('I' + 'love' + 'the' + 'Python' + 'language.')

String concatenation with spaces between the strings. These spaces can be added either at the beginning or at the end of each string:

print('Hello ' + 'Python.')
print('Coding ' + 'is ' + 'really ' + 'fun!')
print('I ' + 'love ' + 'the ' + 'Python ' + 'language.')