In Python, an array can be thought of as a collection of these.
What are "elements" or "values"?
This keyword is used to define a new function in Python.
What is the "def" keyword?
In Python, this method can be used to insert a new element at a specific position in an array.
What is the "insert" method?
In Python, this built-in data type is used to represent a sequence of characters.
What is a "string"?
This famous Renaissance artist is known for his works "The Last Supper" and "Mona Lisa."
Who is Leonardo da Vinci?
When working with arrays in Python, the position of each element is indicated by its unique numeric index, starting at this value.
What is "0"?
In Python, this statement is used to end a function definition.
What is the "return" statement?
In Python, this method can be used to reverse an array.
What is the "reverse" method
This operator is used to concatenate two strings in Python.
What is the plus sign ("+")?
This city in the Greater Toronto Area is home to several tech companies, including Rogers Communications, Loblaw Digital, and MDX-i.
What is Brampton?
The following code returns a error, Why
list = [1,2,3]
print(list[-1*-1 + 3])
This punctuation mark is used to separate multiple function parameters in a function definition.
What is a comma (",")?
This method can be used to sort the elements in a Python array in ascending order.
What is the "sort" method?
This control structure allows code to be executed repeatedly while a given condition is true.
What is a "while loop"?
This programming language was created by Guido van Rossum in the late 1980s and is known for its readability and ease of use.
What is Python?
This built-in function can be used to access a specific element in a Python array, by passing in its index as an argument.
What is the indexing operator (i.e. [])?
the following code returns an error, Why
def square(n):
return n * n
print(square(4))
what is indentation
This method can be used to add a new element to the end of a Python array.
What is the "append" method?
This control structure is used to execute code for a specific number of times.
What is a "for loop"?
This American football team has won the most Super Bowl championships in NFL history, with a total of seven titles.
Who are the New England Patriots?
the following python code prints what
list = [1,2,3]
print(list[-3])
what is 1
what does this code print
def fact(n):
if int(n) == 0:
return(int(1))
else:
return(int(n) * fact(int(n)-1))
print(fact(4))
what is 24
the following code returns
list = [3,6,1]
list.insert(2,1)
list.reverse()
list.sort()
list.reverse()
list.insert(1,5)
print(list)
what is [6, 5, 3, 1, 1]
This built-in function can be used to get the length of a sequence, such as a string or list.
What is the "len" function?
this is the 21st element on the periodic table
What is Scandium(Sc)?