Started with Python Flashcards
Introduction
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 “””
“”” This is a multi-line string “””
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
num_x = 6 – 4
num_x = 2
Which of the following are valid string operations in Python?
“Hello” * “World”
“Hello” * 3
“Hello” + “World”
“Hello” / “World”
“Hello” * 3
“Hello” + “World”
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
Prefix the shell command using ! i.e. !python –version
13 // 5
2
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
num_1 += 10
num_1 = num_1 + 10