Search the courses, subjects, tracks, games and features, or jump straight to a page.
4 cards from this section. Quick, good the night before a test.
Write a simple if statement to check if a number is positive.
Use 'if number > 0:' in your statement.
Create an else statement that prints 'Not positive' if the number is not greater than zero.
Remember how the else statement works.
What keyword is used to conditionally execute a block of code?
Think about the statement that starts with 'if'.
True or False: The else statement is executed if the if condition is true.
Remember what happens when the if condition is true.
Write a program that categorizes animals based on the number of legs (e.g., 2 for birds, 4 for dogs, etc.). Provide a message for any other case.
Think about what animals you can categorize and their typical leg counts.
Create a program that assigns grades based on numerical scores using conditionals (A, B, C, D, F). Define the ranges for each grade.
Remember to define clear ranges for each grade before writing the code.
5 more questions in this section. Enroll free to practise them all.
Enroll free