By the end of this module you can do everything below. The objectives and their wording come from the official PCEP-30-03 syllabus.
1.4.1 Use operators and expressions
- Use numeric operators, including
**,*,/,%,//,+, and-. - Use
+and*with strings where appropriate. - Use assignment and augmented assignment operators.
- Distinguish between unary and binary operators.
- Apply operator precedence, associativity, and binding rules.
- Use the Boolean operators
not,and, andor. - Construct and evaluate Boolean expressions.
- Use relational operators, including
==,!=,>,>=,<, and<=.
1.4.2 Perform console I/O operations and type conversions
- Display values using the
print()function. - Read user input using the
input()function. - Explain that the
input()function returns a string. - Convert values between compatible data types using functions such as
int(),float(), andstr(). - Convert input values to appropriate data types before processing them.
- Combine console input, data conversion, processing, and output in a simple program.