Font size
WorksheetsPython Programming
Total questions: 20
Worksheet time: 40mins
Can be executed by writing directly in the command line?
Syntax
Indentation
Comments
Variables
Is a high-level programming language designed to be easy to read and simple to implement.
(a)
Refers to the spaces at the beginning of a code line to indicate a block of code.
Syntax
Indentation
Comments
Variables
Starts with a "#" and can be used to explain Python code.
Syntax
Indentation
Comments
Variables
Which of the following describes Comments in Python?
Can be used to explain Python code.
Can be used to make the code more readable.
Can be used to prevent execution when testing code.
Are containers for storing data values?
Syntax
Indentation
Comments
Variables
Which of the following describes Variables in Python?
A variable is created when you assign a value to it.
Variables are case-sensitive.
Can be used to prevent execution when testing code.
Which of the following has the correct indentation?
myVariableName = “CodeCombat”
Camel Case
Pascal Case
Snake Case
MyVariableName = “CodeCombat”
Camel Case
Pascal Case
Snake Case
my_variable_name = “CodeCombat”
Camel Case
Pascal Case
Snake Case
Which of the following are vaild variables?
myvar = “CodeCombat”
my-var = “CodeCombat”
MYVAR = “CodeCombat”
2myvar = “CodeCombat”
Are created using square [ ] brackets.
List
Tuple
Set
Dictionary
Are created using round ( ) brackets.
List
Tuple
Set
Dictionary
Are created using curly { } brackets. This collection is unordered, unchangeable, and unindexed.
List
Tuple
Set
Dictionary
Are used to store data values in key:value pairs.
List
Tuple
Set
Dictionary
The (a) keyword is pythons way of saying “if the previous conditions were not true, then try this condition”.
The (a) keyword catches anything which isn't caught by the preceding conditions.
What is the positive index of the item "mouse"
animals = ["cat", "dog", "mouse", "bird"]
0
1
2
3
What is the negative index of the item "dog"
animals = ["cat", "dog", "mouse", "bird"]
-1
-2
-3
-4
