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. |
Want to learn more?
Join CodeFriends Plus membership or enroll in a course to start your journey.