Python Flashcards

(55 cards)

1
Q

What year was Python invented?

A

1991

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

Why Python?

A

-similar to English/Math
-support lots of frameworks/libraries
-easy to learn

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

What are 4 ways to use Python?

A

-Web development
-Artificial intelligence
-Machine learning
-Data analytics

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

What is a key advantage of Python?

A

Less code, speed to market

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

What does IDE stand for?

A

Integrated development environment

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

What 6 features does IDE Visual Code have?

A

-auto-completion
-debugging
-code syntax
-highlighting
-white space
-indentation helpers

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

What are 3 reasons for commenting on code?

A

-explain what code is intended to do
-let developers know code is depreciated
-add TO-DO comments for work to do at a later time

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

What are the 3 ways you can comment on code?

A

-single-line
-multi-line
-inline

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

What is an example of a single-line comment?

A
  • # this is my comment
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is an example of multi-line comments?

A
  • # this is my comment# and this too
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is an example of an online comment?

A

X = 5 # this is my comment

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

What is a variable?

A

-a value that can change, depending on conditions or on information passed to the program

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

Can variables be changed?

A

Yes

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

What is an important rule about naming variables?

A

Give meaningful names in context

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

What are two ways to name(write) variables?

A

-camelcase
-snakecase

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

What is camelcase?

A

myName

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

What is snakecase?

A

my_name

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

How do you delete a variable?

A

A = 10

del A

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

What is a data type?

A

An attribute associated with a piece of data that tells the computer how to interpret its value.

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

What are the 5 data types?

A

-numeric
-sequence
-dictionary
-boolean
-set

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

What are the 3 types of numeric data types?

A

-integer
-float
-complex

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

What is an integer?

A

-non fractional number.
10, -10

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

What is a float?

A
  • a number with decimal places
    10.5, 3.2
24
Q

What is a complex numeric data type?

A

Real and imaginary numbers
A = 10 + 10j

25
What are the 3 types of sequence data types?
- strings - lists - tuples
26
What is a string?
Sequence of characters enclosed in single or double quotes
27
What is the abbreviation for string?
str
28
What are examples of strings?
‘John’ “This is a string” Name = “John”
29
What are lists?
Sequence of one or more types
30
What brackets do lists use?
Square Brackets
31
What is an example of a list?
list = [4, “hello”, A, 3.2]
32
What is the abbreviation for lists?
list
33
What are tuples?
An ordered sequence of one or more types
34
What is a difference between lists and tuples?
Tuples are immutable. Can not be changed or modified
35
What is a dictionary?
Store data in a key value object structure
36
What is the abbreviation for dictionary?
dict
37
What is an example of a dictionary?
ed = {‘a’:22, ‘b’:44.2}
38
What brackets do dictionaries use?
Curvy brackets
39
What is a Boolean?
True or False statement
40
What is the abbreviation for Boolean?
bool
41
What is a set?
An unordered and non-indexed collection of non-repeated values
42
How do you check a data type?
a = 10.0 print(type(a)) Class ‘float’
43
What are 2 ways that you can write strings?
-single line -multi-line
44
What is an example of a single line string?
varA = “Hello World”
45
What is an example of a multi-line string?
varB = “this is too big\ to fit on\ a single line”
46
How do you access a character of a string?
name = “John” print(name[2]) h
47
How do you check the length of a string?
len() name = “John” print(len[name]
48
What is concatenation?
Joining of separate strings
49
How do you concatenate?
a = “Hello” b = “World” print(a + b) Hello World
50
What does == mean?
Equals
51
What does != mean?
Not equal
52
What does < mean?
Less than
53
What does > mean?
More than
54
What does <= mean?
Less than or equal too
55
What does >= mean?
Greater than or equal too