Grokking Python Fundamentals
Ask Author
Back to course home

0% completed

Vote For New Content
Quiz
Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Which Python statement is used to execute code based on a condition?
A
for
B
if
C
while
D
switch
What will the following code print?
x = 10
if x > 5:
    print("Greater")
else:
    print("Lesser")
A
Lesser
B
Greater
C
Nothing
D
Error
How do you write an if statement in Python to check if a is equal to 10?
A
if a = 10:
B
if a === 10:
C
if a == 10:
D
if a != 10:
What is the output of the following code?
a = 20
if a < 10:
    print("Less than 10")
elif a < 15:
    print("Less than 15")
else:
    print("15 or more")
A
Less than 10
B
Less than 15
C
15 or more
D
Error
Which keyword is used in Python 3.10 and later for a switch-like statement?
A
switch
B
case
C
match
D
select

.....

.....

.....

Like the course? Get enrolled and start learning!

Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible