A reusable block of code that performs a specific task.
What is a method (or function)?
A blueprint used to create objects.
What is a class?
The data type used to store whole numbers.
What is int?
A named storage location for data.
What is a variable?
The operator used for exponentiation.
What is **?
Which keyword is used to create a method in Python?
What is def?
The special method automatically called when an object is created.
What is __init__()?
The data type used to store decimal values.
What is float?
score = 10
score = 15
print(score)
What is 15?
print(20 // 3)
What is 6?
What value is returned by a method if no return statement is written?
What is None?
True and False belong to this data type.
What is bool?
x = 5
y = x
x = 8
Value of y.
What is 5?
print(25 % 3)
What is 1?
def multiply(a, b):
return a * b
print(multiply(4, 5))
What is 20?
class Cat:
def __init__(self):
self.age = 2
kitty = Cat()
print(kitty.age)
What is 2?
Data type of x.
a = 23
b = 23.5
c = a + b
What is 46.5?
Adding two Strings.
What is concatenation?
def mystery(x):
return x * 2 + 3
print(mystery(4))
What is 11?
class Student:
def __init__(self, grade):
self.grade = grade
s = Student(95)
print(s.grade)
What is 95?
x = 3
y = 4.0
z = x + y
Data type of z.
What is a float?
name = "Python"
print(name[2])
What is "t"?
print((8 + 4) // 3 * 2)
What is 8?