CH 3 - DATA HANDLING (Module 4) Flashcards

1
Q

python built in core data types

A
  1. numbers
  2. strin
  3. list
  4. tuple
  5. dictionary
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

numbers (types)

A
  1. integers
    i. integers (signed)
    ii. booleans
  2. floating point numbers
  3. complex numbers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

bool(0)

A

false

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

bool(1)

A

true

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

floatin point numbers advantages over inteers

A
  1. they can represent values between inteer

2 wider range of numbers it can represent

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

disadvantae of floatin point number

A

they are slower than inteer operations

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

python respresents complex numbers in what form

A

A + Bj
a = 0 + 3.1j
b = 1.5 + 2j

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

why is j symbol used to represent complex number i

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

z = 2.5 + 3.9j

print(z.real) and print(z.imag)

A

2.5 and 3.9

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

python index or subscript

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

python indices length

A

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

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

are strings immutable or mutable

A

IMMUTABLE

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

how are strings immutable

A
  • 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

lists [1, 2, 3]

A

lists in python represent a list of comma separated values of any datatype between square brackets

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

are lists immutable or mutable

A

mutable

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

a = [1, 2, 3] chane 1 to 10 in th elist

A

a [0] = 10
print(a)
a = [10, 2, 3]

17
Q

tuples ( )

A

represented as a roup of comma separated values of any data type with paranthesis/ brackets

18
Q

are lists immutable or mutable

A

immutable

19
Q

sets

A

similar to lists that can store multiple values same as mathematical sets

20
Q

differences bw sets and lists

A

sets lists
{ } [ ]
unordered and unindexed
doesnt allow duplicate entries
cannot contain mutable elements
SIMILARITY: BOTH ARE MUTABLE THO

21
Q

what deos it mean that sets cannot CONTAIN mutable elements

A

a list cannot exist inside a set
ex: { 1, 2, [3, 4] } = 3,4 is a list which is written inside set

however, a tuple CAN BE CONTAINED inside a set since a tuple is immutable
ex: { 1, 2, (3, 4)

22
Q

are sets immutable or mutable

A

MUTABLE

even thouh it cannot contain mutable elements, it is MUTABLE

23
Q

dictionary

A

it is an unordered set of comma sepaqrated key: value pairs within { }

  • no keys can be the same in a dictionary
  • THERE ARE UNIQUE KEYS IWTHIN A DICTIONARY
24
Q

everything is a ______ in python

A

object: it is an entity that has certain properties and that exhibit a certain type of behaviour
- python calls every entity that stores any values or any type of data as an object
- cuz python is an object oriented language
- strins, tuples, lists, dictionaries (all data types), inteers, numbers, variables are all objects

25
Q

id function?

A

the id function when you use on any data value or variable, it returns the unique identity of the object, which is its assigned memory address

26
Q

mutability means

A

it means that in same memory address, new value can be stored as in when you want.
-the types that do not support this property are immutable type data objects

27
Q

exs of immutable type data objects

A
inteers
floatin point nos
booleans
strins
tuples
28
Q

mutable type data objects in python are

A

list
dictionaires
sets

29
Q

unicode code or lexicoraphical code

A

the ordinal values of the characters
ordinal code of small alphabets is reater than those of capital alphabets
a > A
97 > 65

30
Q

EQUALITY AND IDNTITY (is) IMPORTANT REATION

A
1. If a IS b = TRUE
then, a == b
However,
2. If a ==b
a IS b need not be true