operators Flashcards

1
Q

Escape Sequences: \n, \r, ', ", \, \b, \f, \t, \v, \uXXXX or \UXXXXXXXX

A

\n: Newline character.

\r: Carriage return character.

': Single quote.

": Double quote.

\: Backslash.

\b: Backspace.

\f: Form feed.

\t: Tab.

\v: Vertical tab.

\uXXXX or \UXXXXXXXX: Unicode escape sequences.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Arithmetic Operators: +, -, *, /, %, **, //

A

+ Addition

  • Subtraction
  • Multiplication

/ Division

% Modulus (remainder after division)

** Exponentiation (e.g., 2**3 means 2 to the power of 3)

// Floor Division (returns the quotient, discarding any remainder)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Comparison Operators: ==, !=, <, >, <=, >=

A

== Equal to

!= Not equal to

< Less than

> Greater than

<= Less than or equal to

> = Greater than or equal to

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Assignment Operators: =, +=, -=, *=, /=, %=, **=, //=

A

= Assignment

+= Add and assign

-= Subtract and assign

*= Multiply and assign

/= Divide and assign

%= Modulus and assign

**= Exponentiation and assign

//= Floor Division and assign

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

‘and’ operator

A

returns true if both statements are true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

‘or’ operator

A

returns true if one of the statements is true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

‘not’ operator

A

reverse the result, returns false if the result is true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Bitwise Operators:

A

& : sets each bit to 1 if both bits are 1

^ : sets each bit to 1 if only one or two bits is 1

~ : inverts all the bits

&laquo_space; : shift left by pushing zeros in from the right and let the leftmost bits fall off

> > : shift right by pushing copies of the leftmost bit in from the left, and let the rightmost bits fall off

: sets each bit to 1 if one of two bits is 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Identity operators:

A
  • Is true if the operands are identical objects
  • Is not true if the operands are not identical objects
How well did you know this?
1
Not at all
2
3
4
5
Perfectly