Python Coding Flashcards

(34 cards)

1
Q

What is the symbol for an integer?

A

int()

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

What is the symbol for a string?

A

str()

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

What is the symbol for a float?

A

float()

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

What is the symbol for a Boolean?

A

bool()

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

What is the function for the length of a string?

A

len()

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

What is the function for an output?

A

print()

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

What is the function for an input?

A

input()

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

What is the function to find the largest number in a set?

A

max()

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

What is the symbol for assignment?

A

=

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

What command is used to assign a set of values to a list?

A

listName = [value, value]

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

What is the command used to identify an item of a list by its position?

A

listName[index]

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

How is an if loop written in python?

A

if … :
….
elif… :
….
else:
….

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

How is a for loop written in python?

A

for i in range x:

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

How is a while loop written in python?

A

while … :

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

What is the symbol for divide?

A

/

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

What is the symbol for multiply?

17
Q

What is the symbol for exponential?

18
Q

What is the symbol for add?

19
Q

What is the symbol for subtract?

20
Q

What is the symbol for integer division / quotient?

21
Q

What is the symbol for modulus?

22
Q

What is the symbol for equal to?

23
Q

What is the symbol for not equal to?

24
Q

What is the symbol for greater than?

25
What is the symbol for greater than or equal to?
>=
26
What is the symbol for less than?
<
27
What is the symbol for less than or equal to?
<=
28
What is the symbol for the Boolean operator and?
AND
29
What is the symbol for the Boolean operator or?
OR
30
What is the symbol for the Boolean operator not?
NOT
31
What is the symbol for a comment?
#
32
How can a number be square-rooted?
import math math.sqrt()
33
How can a random number be selected?
import random random.randint(…,…)
34
How can a value be appended to a list?
listName.append()