This character denotes the division operator.
The forward-slash (/)
This common variable type stores letters, numbers, and symbols.
A string
This statement checks the validity of a statement before creating a branch.
if statement
The two types of loops in Python.
For & while loops
What should be the condition that is missing from the following code segment:
age = int(input("Enter your age: "))
if ___________:
print("Eligible for voting)"
else:
print("Not eligible for voting")
age >= 18
These characters have the highest order of operation in Python.
Parenthesis
This variable type stores decimal numbers.
A float
This boolean operator checks if the value on the left is greater than the value on the right.
>
This is a type of loop that never stops iterating.
infinite loop
How would a reverse range look like where you print out numbers using a negative step where the start = 5 and the stop = -1
5
4
3
2
1
0
The result of 9 / 5
1
Data stored as a string is surrounded by these.
Quotes
What is the value of 'x' after the following Python code has completed executing?
x = 100
for n in range(1,5):
x = x*n
print x
2,400
These characters MUST be put at the end of every function call.
parentheses
To raise the number 5 to the power of 8, you must use the power operator. This/These symbol(s) denotes the power operator.
Two asterisks (**)
What is the output of the following program:
if Time>30:
Time=Time+Time%3
Time=Time//3
print (Time)
else:
Time= Time%2-(Time/2)
print (Time)
-15.0
The following Python code loops forever. What is it missing?
n = 10
while n<100:
print n
an increment statement
What is the output of the following program:
for i in range (1,11,3):
if i%2==0:
print (i)
4
10
Denoted as '%', this operator returns the remainder of a division operation.
Modulus
How can we swap the values of two variables (A & B) using a temp variable?
temp=A
A=B
B= temp
What is the output of the following program:
y=30.0
if (y%5!=y%3):
y=y//7
else:
y= y**2
print (y)
900.0
What will be displayed as a result of running the program below:
def evenOrOdd(x):
if x%2==0:
print ("Even")
else:
print ("Odd")
for i in range (1,11,3):
evenOrOdd(i)
Odd
Even
Odd
Even