Font size
WorksheetsPython Check
Total questions: 11
Worksheet time: 7mins
def mystery(x):
return x * x - x
print(mystery(4))
Which of the following is a default built-in function in Python?
sqrt()
for i in range(1, 5):
if i % 2 == 0:
print(i, end=" ")
What would be output?
1 2 3 4
2 4
1
3
0 2 4
(a) math module function is used to return the smallest integer greater than or equal to a number
x = 5
while x > 0:
x -= 1
if x == 2:
continue
print(x, end=" ")
Identify the output.
4 3 1 0
4 3
4
3
4
3
1
0
The keyword (a) is used in Python to define a user-defined function.
The for loop uses a built-in function called (a) to generate a sequence.
The sqrt(16) returns 4.0
True
False
Error
def calc(x, y=3):
return x + y
print(calc(4))
num = 10
if num % 3 == 0:
print("Divisible by 3")
elif num % 5 == 0:
print("Divisible by 5")
else:
print("Not divisible")
Not Divisible
Write the missing condition to print numbers from 5 to 1 using a while loop:
i = 5
while ?????:
print(i)
i -= 1
i <= 1
i <= 0
