Python Strings and Basic Operations

Python Strings and Basic Operations

Assessment

Flashcard

Computers

University

Hard

Created by

Mrs. 1

FREE Resource

Student preview

quiz-placeholder

8 questions

Show all answers

1.

FLASHCARD QUESTION

Front

What is the syntax to create a single-line string in Python?

Back

s1 = 'I B.Tech' or s2 = 'Robotics'.

2.

FLASHCARD QUESTION

Front

How do you create a multi-line string in Python?

Back

s3 = """This is a multi-line string""".

3.

FLASHCARD QUESTION

Front

What function is used to get the length of a string in Python?

Back

len() function.

4.

FLASHCARD QUESTION

Front

What is the output of print(len(text)) if text = 'Python'?

Back

6.

5.

FLASHCARD QUESTION

Front

What does print(text[0]) return if text = 'Python'?

Back

'P'.

6.

FLASHCARD QUESTION

Front

What does print(text[-1]) return if text = 'Python'?

Back

'n'.

7.

FLASHCARD QUESTION

Front

What does print(text[0:4]) return if text = 'Python'?

Back

'Pyth'.

8.

FLASHCARD QUESTION

Front

What does print(text[::-1]) return if text = 'Python'?

Back

'nohtyP'.