Reminders/important bits Flashcards

1
Q

How do you calc 0o142?

A

142 = length 3
therefore 8^2 8^1 8^0

0o142 = 1* 8^2 + 4* 8^1 + 2* 8^0

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

How do you calc 0x142?

A

142 = length 3
therefore 16^2 16^116^0

0x142 = 116^2 + 416^1 + 2*16^0

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

How do you calc binary 011?

A

011 = length 3
therefore 2^2 2^1 2^0

011 = 0* 2^2 + 1* 2^1 + 1*2^0

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

Which is always bigger 0x number or 0o number ?

A

0x

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

Type([5]) …..

A

list

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

Type({5}) …..

A

set

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

Type((5)) …..

A

int

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

Type((5,)) …..

A

tuple

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

Type((‘5’)) …..

A

str

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

In ASCII is a and A odd or even?

A

Odd

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

What is the order of ASCII?

A

Digits (0-9) Capitals (A-Z) lowercase (a-z)

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

What is the function to change a character/number to ASCII?

A

ord()

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

What is the function to change a ASCII number to normal char/num?

A

chr()

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

What to remember about insert()?

A

insert( position , what_to_insert )

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

How is power ** binded?

A

right to left

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

What does 0%n equal?

A

0

17
Q

What does n%0 equal?

A

Zero Division Error

18
Q

What does [::-1] do?

A

it reverses the string

[ start : end : step ]

start default = 0
end default = end of string

19
Q

What is len(‘\ \ \ \ ‘)?

A

2

as \ escape character

20
Q

How is continue different to pass?

A

Continue forces the code to ignore the rest of the code in the current iteration (after continue) and move onto the next iteration in the for loop

Pass does nothing

21
Q

What does this do?
{key:value for value, key in dic.items()}

A

swaps values and keys in dic

22
Q

To handle exceptions, Python has four major defined components…….

A

try
except
else
finally