Podcast
Questions and Answers
What is the data type used to represent text in Python?
What is the data type used to represent text in Python?
- str (correct)
- bool
- float
- int
Which of the following is a correct way to create a multi-line string in Python?
Which of the following is a correct way to create a multi-line string in Python?
- multiline_string = 'First line Second line'
- multiline_string = ('First line' 'Second line')
- multiline_string = '''First line Second line''' (correct)
- multiline_string = 'First line' 'Second line'
Which of the following is the correct way to access the last character of a string 'my_string' in Python?
Which of the following is the correct way to access the last character of a string 'my_string' in Python?
- my_string[-1] (correct)
- my_string[-len(my_string)]
- my_string[len(my_string)-1]
- my_string[len(my_string)]
What does the method 'strip()' do when used on a string in Python?
What does the method 'strip()' do when used on a string in Python?