What is the symbol used to represent comments in Python?
(#) symbol
This function prints whatever is given to it.
print()
This is the operator used to concatenate
+
4**2 is equal to this number.
16
This is what we call a sequence of instructions that accomplish a goal.
program
What is the difference between "==" and "=" in Python?
==" is a comparison operator used to check if two values are equal, while "=" is an assignment operator used to assign a value to a variable.
This is a way of repeating a set of code many times
loop
This symbol is used to comment out one line of code
#
This code would return:
x,y = 1,2
print(x - y + x * y)
1
Another name for coffee, this programming language was invented in 1995
Java
What is the syntax for printing "Hello, World!" to the console in Python?
print("Hello, World!")
Variables can be defined both inside or outside of a function. This determines if a variable is inside or outside of the function.
spacing or indent
This is used to create multi-line comments.
"""
This code outputs:
x = 3
If x == 3:
print("x<5 and x<4")
error
Grace Hopper found the first of these inside a computer, which became the term we use to refer to flaws in the code we write
bugs
What is the syntax for creating a list in Python?
myList = [1, 2, 3, 4, 5]
This Code Outputs:
x = "12"
print(x - x +12)
error
This operation is represented by % to get the remainder.
modulo/modulus
Here's a bit of code. It would print:
season = "Spring is the best"
for i in range(5):
print(season)
Spring is the best
Spring is the best
Spring is the best
Spring is the best
Spring is the best
Refers to the process of converting one data type into another
Type Conversion
The name of this operator:
!=
Not equal to
What does this function output?
x = 2
x +=6
x -=10
x *= -1
print(x)
if float(x) == 2:
print("x is two")
elif x != 2:
print("x is not two")
x is two
True or false:
There are 6 different data types in python
true
#Change a Range of Item Values
thislist = ["apple", "banana", "cherry", "orange", "kiwi", "mango"]
thislist[1:3] = ["blackcurrant", "watermelon"]
print(thislist)
['apple', 'blackcurrant', 'watermelon', 'orange', 'kiwi', 'mango']
These are numbers with both a real and an imaginary part. The imaginary part is represented by the letter "j" or "J"
Complex Numbers (complex)