Started with Python Flashcards

Introduction

1
Q

Question: What is the correct syntax for specifying multi-line strings in Python?
Instruction: Choose the option that best answers the question.
Answer Choices

‘This is a multi-line string ‘

“” This is a multi-line string ””

“ This is a multi-line string ”

“”” This is a multi-line string “””

A

“”” This is a multi-line string “””

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which of the following commands are valid to store a numeric value of 2 in a variable named num_x?

num_x == 2
num_x = “2”
num_x = 6 – 4
num_x = 2

A

num_x = 6 – 4
num_x = 2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which of the following are valid string operations in Python?
“Hello” * “World”

“Hello” * 3

“Hello” + “World”

“Hello” / “World”

A

“Hello” * 3
“Hello” + “World”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can you execute shell commands on Jupyter notebook code cells?

Prefix the shell command using ! i.e. !python –version

Enclose the command in quotes i.e. “python –version”

Prefix the shell command using @ i.e. @python –version

Just run the shell command like a Python command i.e. python –version

A

Prefix the shell command using ! i.e. !python –version

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

13 // 5

A

2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Question: If you want to increment the value stored in the num_1 variable by 10 which of the following Python statements are valid?

num_1 += 10
num_1 == num_1 + 10
num_1 = num_1 + 10
num_1 = 10

A

num_1 += 10

num_1 = num_1 + 10

How well did you know this?
1
Not at all
2
3
4
5
Perfectly