- Understanding conditional statements and their role in programming.
- Exploring the
ifstatement and its syntax. - Using comparison operators (
==,!=,>,<,>=,<=) to create conditions. - Understanding the
elifandelsestatements for handling multiple conditions.
- Understanding looping statements and their role in repeating actions.
- Exploring the
forloop and its syntax. - Using the
forloop to iterate over a sequence of values. - Exploring the
whileloop and its syntax. - Understanding the
breakandcontinuestatements for loop control.
-
Print even numbers:
- Write a program that prints all even numbers from 1 to 20.
- Use a looping statement to iterate over the numbers.
- Check if each number is even using a conditional statement.
- Print the even numbers.
-
Temperature conversion:
- Write a program that converts temperatures from Celsius to Fahrenheit.
- Prompt the user for a temperature in Celsius.
- Use a conditional statement to check if the input is valid.
- If valid, convert the temperature to Fahrenheit using the formula:
F = (C * 9/5) + 32. - Print the converted temperature.
-
Find the maximum number:
- Write a program that finds the maximum number from a given list of numbers.
- Use a loop to iterate over the list elements.
- Keep track of the maximum number encountered so far using a variable.
- After the loop, print the maximum number.
Estimated time to complete this module is approximately 4-6 hours.
To further enhance your learning, here are some additional resources:
- Python Documentation on Control Flow: https://docs.python.org/3/tutorial/controlflow.html
- Real Python's Conditional Statements in Python: https://realpython.com/python-conditional-statements/
- Real Python's Looping Techniques in Python: https://realpython.com/python-for-loop/