Category | Operator | C++ | Python |
Assignment | Assignment | = | = |
Arithmetic | Addition | + | + |
Subtraction | - | - | |
Multiplication | * | * | |
Division | / | / | |
Integer Division | / (but returns float) | // | |
Modulo | % | % | |
Exponentiation | pow(x, y) or <cmath> | ** | |
Relational | Equal to | == | == |
Not equal to | != | != | |
Greater than | > | > | |
Less than | < | < | |
Greater or equal | >= | >= | |
Less or equal | <= | <= | |
Logical | AND | && | and |
OR | ` | ||
NOT | ! | not | |
Bitwise | AND | & | & |
OR | ` | ` | |
XOR | ^ | ^ | |
NOT | ~ | ~ | |
Shift Left | << | << | |
Shift Right | >> | >> | |
Membership | In | N/A | in |
Not in | N/A | not in | |
Identity | Is / Is not | N/A | is, is not |
Ternary | Conditional expression | cond ? a : b | a if cond else b |
Increment/Decrement | ++ / -- | ++x, x++, --x, x-- | Not supported (use x += 1) |
Computer Methods in Science Course
Subscribe to:
Post Comments (Atom)
Basic Comparison of C++ and HTML/JavaScript
Here’s a basic comparison of C++ and HTML/JavaScript for common programming concepts and simple code examples for each. This will help ...
-
<button onclick="drawX()">Draw X</button> <!-- Button to call the 'drawX' function when clicked --> <...
-
#include <iostream> #include <fstream> using namespace std; // Function to sort an array of integers using Selection Sort void ...
-
In mathematics, Pascal's triangle is a triangular array of the binomial coefficients Coasters (Set of 4) $13.91 #MOVING #EYE #ILLUSION #...
No comments:
Post a Comment