Python Common Operators Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Add two numbers.
Join two strings together.
What’s its name and operator?

A

Plus

+

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

Subtract a number from another.
Can’t use for string.
What’s its name and operator?

A

Minus

-

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

Multiply two numbers.
Make copies of a string.
What’s its name and operator?

A

Times

*

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

Divide one number by another.
Can’t use for strings.
What’s its name and operator?

A

Divide

/

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

Give the remainder when dividing the left number by the right number.
Formatting operator for string in Python2.
What’s its name and operator?

A

Remainder

%

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

x**y means raise x to the power of y.
Can’t use for string.
What’s its name and operator?

A

Power

**

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

Assign the value on the right to the variable on the left.

What’s its name and operator?

A

Assignment

=

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

Is the left side equal to the right side? True if so; is False otherwise.
What’s its name and operator?

A

Equality

==

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

Is the left side not equal to the right side? True if so; is False otherwise.
What’s its name and operator?

A

Not equal

!=

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

Is the left side greater than the right side?

What’s its name and operator?

A

Greater than

>

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

Is the left side less than the right side?

What’s its name and operator?

A

Less than

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

Are both left and right true? Usually for complex conditions where you want to do something if everything is true.
What’s its name and operator?

A

And
&
and

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

Is either left or right true? Usually for complex conditions where you want at least one thing to be true.
What’s its name and operator?

A

Or
|
or

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