Variables and Simple Data Types Flashcards
What is Variable?
Label can be assigned to values
Variable refferences a certain value
Variable syntax
message=”Hello World!”
print(message)
What is Method in Python?
A function explicitly available for a given object because of the object’s type
Lists dont have .upper() method and strings dont have .append()
Method & Syntax
name=”holala”
print(name.title(an argument))
How to use Variable inside of String?
F-String!
f-format
F-String syntaxis
variable=f”Hello {variable} {variable}!”
How to strip whitespace?
.strip() - both sides
r/l strip() - for R/L
What is Float
Any number with decimal point (1.5)
Python is default to Float in any operation that uses float
How to assign multiple values to one Variable?
x,y,z=1,2,5
What is CONSTANT?
Variable whose value should not be changed
MAX_CONNECTIONS=5000
Python does not have built-in constant types