CH 3 - DATA HANDLING (Module 4) Flashcards
python built in core data types
- numbers
- strin
- list
- tuple
- dictionary
numbers (types)
- integers
i. integers (signed)
ii. booleans - floating point numbers
- complex numbers
bool(0)
false
bool(1)
true
floatin point numbers advantages over inteers
- they can represent values between inteer
2 wider range of numbers it can represent
disadvantae of floatin point number
they are slower than inteer operations
python respresents complex numbers in what form
A + Bj
a = 0 + 3.1j
b = 1.5 + 2j
why is j symbol used to represent complex number i
z = 2.5 + 3.9j
print(z.real) and print(z.imag)
2.5 and 3.9
python index or subscript
the numbered position of a letter in the string
- a python string is a sequence of characters and each character can be accessed using its index
- strings in python are stored as INDIVIDUAL CHARACTERS in contiguous location with TWO WAY INDEX for EACH LOCATION
python indices length
python indices begin 0 onwards in forward direction and -1, -2 in backward direction
- the length of python index of any string from forward would be lenth-1 since index starts from 0
are strings immutable or mutable
IMMUTABLE
how are strings immutable
- you cannot change the individual letters of a string in place by assignment because STRINS ARE IMMUTABLE
- hence, ITEM ASSINMENT IS NOT SUPPORTED
for ex:
name = “hello”
name[0] = “p”
error aayega
lists [1, 2, 3]
lists in python represent a list of comma separated values of any datatype between square brackets
are lists immutable or mutable
mutable