Variables and Simple Data Types Flashcards

1
Q

What is Variable?

A

Label can be assigned to values

Variable refferences a certain value

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

Variable syntax

A

message=”Hello World!”
print(message)

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

What is Method in Python?

A

A function explicitly available for a given object because of the object’s type

Lists dont have .upper() method and strings dont have .append()

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

Method & Syntax

A

name=”holala”

print(name.title(an argument))

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

How to use Variable inside of String?

A

F-String!

f-format

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

F-String syntaxis

A

variable=f”Hello {variable} {variable}!”

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

How to strip whitespace?

A

.strip() - both sides

r/l strip() - for R/L

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

What is Float

A

Any number with decimal point (1.5)

Python is default to Float in any operation that uses float

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

How to assign multiple values to one Variable?

A

x,y,z=1,2,5

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

What is CONSTANT?

A

Variable whose value should not be changed

MAX_CONNECTIONS=5000

Python does not have built-in constant types

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