8.1.2 - Control Structures
Enroll to start learning
You’ve not yet enrolled in this course. Please enroll for free to listen to audio lessons, classroom podcasts and take practice test.
Practice Questions
Test your understanding with targeted questions
Create an if-else statement that checks if a number is positive or negative.
💡 Hint: Think about how you can determine if a number is greater or less than zero.
Write a for loop that prints the first 5 positive integers.
💡 Hint: You want to iterate from 1 to 5.
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What is the purpose of an if-else statement?
💡 Hint: Think about what an if statement does.
True or False: For loops require a condition to stop iterating.
💡 Hint: Consider how a for loop functions compared to a while loop.
2 more questions available
Challenge Problems
Push your limits with advanced challenges
Write a program that uses if-else statements to categorize animals based on their type: Mammals, Birds, etc. Use user input for animal type.
💡 Hint: Use lists to define the categories of animals.
Write a program that prompts the user to enter a number and prints whether it's odd or even using a while loop.
💡 Hint: Think about using the modulus operator to determine if a number is even or odd.
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.