C4: Python for Data Science, AI & Development Flashcards
str()
String data type object.
int()
Integer data type object.
float()
Floating Point data type object.
list()
Returns a list of the elements in an object.
E.g.,
Var = “Panks”
list(Var) : (“P”,”a”,”n”,”k”,”s”)
int(3.55):?
3
Here you are casting a floating point through a integer data type, which may have strange results.
float(15):?
15.0
Here you are casting a integer into a floating point data type.
str(4.558):?
“4.558”
Here you are casting a floating point number into a string data type
What are the two Boolean expressions in Python?
True & False*.
They must be camel case.
int(True):?
1
int(False):?
0
bool(1):?
True.
bool(0):?
False.
What is an Operand?
The thing to be operated on.
What is an Operator?
What the Operand opperates on.
type()?
Returns the data type of variable.
Good for debugging.
What’s Typecasting?
Converting one data type into another.
Define Tuple.
1) An Ordered set of numbers.
2) Where the order cannot change.
- The sequence cannot be changed.
- Set is finite.
- Set may contain duplicates.
n-tuple
(X1, … , Xn)
What does RegEx mean?
Regular Expression.
- A Python module.
- A tool for matching and handling strings.
> > > import re
Imports the Regular Expression module built into Python 3.
Concatenation
Combines strings.
Major Data Type Objects in Python.
Integers
Floating Points
Strings
Booleans
Coupoud Data Type Objects? - Python
- Lists
- Tuples
Tuples syntax? - Python
var = (X1,X2,…,…,Xn)