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 program that checks if a number is positive, negative, or zero.
Use if, elif, else statements to categorize the number.
What will the following code print?
age = 16
if age >= 18:
print("Eligible")
else:
print("Not eligible")Evaluate age against 18.
What does the else statement do?
Think about what happens when conditions aren’t met.
True or False: The elif statement is used to check multiple conditions.
Remember how the flow moves in decision making.
Create a program that simulates a year-end bonus based on hours worked and performance rating. If rating is 'excellent', the bonus is 20%, 'good' is 10%, and 'poor' gets no bonus.
Use conditions to evaluate performance ratings.
Develop a nested program that evaluates student attendance. If present over 75% and passing grades, award a certificate.
Consider how both factors of attendance and grades interact.
5 more questions in this section. Enroll free to practise them all.
Enroll free