Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
Write an if-else statement to check if a variable x is greater than 5.
Remember to correctly format your conditions.
Create an if statement to print 'Good morning' if the hour is less than 12.
Only check the hour condition.
What will the following code print if age is 16?
if age >= 18:
print('Adult')
else:
print('Minor')Think about what the comparison operator does!
True or False: The elif statement can be used to chain multiple conditions.
Recall how we can check multiple scenarios sequentially.
Write a program that checks a user's username. If it is 'admin', print 'Access granted'; if it is 'guest', print 'Access limited'; otherwise, print 'Access denied'.
Remember to check the username step-by-step.
Create a grading system based on scores. If the score is 90 or above, print 'Grade: A'; if between 80 and 89, print 'Grade: B'; if between 70 and 79, print 'Grade: C'; otherwise, print 'Grade: F'.
Use sequential checking for grading conditions.
5 more questions in this section. Enroll free to practise them all.
Enroll free