Lecture
Key English Expressions for Operators and Expressions
Operators, which perform mathematical and logical calculations, are fundamental elements you will encounter while explaining or debugging code.
In this lesson, we'll first review basic mathematical expression phrases and then explore the names and usages of key operators frequently used in programming.
Frequently Used Mathematical Expression Phrases
| English Expression | Interpretation in English |
|---|---|
Add 3 to an integer variable. | Add 3 to an integer variable. |
Subtract 10 from an integer variable. | Subtract 10 from an integer variable. |
x % 100 returns the last 2 digits of x. | x % 100 yields the last 2 digits of x. |
x % y returns the remainder when x is divided by y. | x % y gives the remainder of x divided by y. |
x ** (1/2) computes the square root of x. | x ** (1/2) calculates the square root of x. |
x // y returns the floor of x divided by y. | x // y returns the floor of the quotient of x divided by y. |
Round x to the nearest integer. | Round x to the nearest integer. |
Round x up to the next integer. | Round x up to the next integer. |
Round x down to the previous integer. | Round x down to the previous integer. |
Truncate x by discarding its fractional part. | Truncate x by removing its fractional part. |
Lessons in this chapter · How to Explain Code in English
- 1. Common English Phrases for Git
- 2. Key Expressions for Variables and Constants
- 3. Key Expressions for Input and Output
- 4. Key English Expressions for Operators and Expressions
- 5. Multiple-choice quiz
- 6. Common English Expressions for Functions
- 7. English Expressions for Conditional Statements
- 8. Common English Expressions for Loops
- 9. Common English Expressions in Object-Oriented Programming
- 10. Fill-in-the-blank quiz
- 11. English Expressions for Network Communication
- 12. Common English Expressions for Error Handling
- 13. Security-Related English Expressions
Quiz
0 / 1
Which of the following correctly describes subtraction?
Subtract 10 to an integer variable.
Subtract 10 from an integer variable.
Subtract 10 for an integer variable.
Subtract 10 with an integer variable.
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help