Data Types, Evaluations, and Basic I/O Flashcards

section 2

1
Q

assignment priorities

A

mdascnao

**, *, /, //, %, +, -, ==, !=, <= , >=, <, >, not, and, or

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

Bit wise operations

~, &, ^, |, «,&raquo_space;

A

x~ - returrns complement of x
x & y - ‘bitwise and’
x^y - ‘bitwise exclusive or’
x|y - ‘bitwise or’
x &laquo_space;y - moves x bit to the right by y places
x&raquo_space; y - moves x bit to the left by y places

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

Accuracy of floating point numbers

A

floating point numbers have between 6 & 7 digits of precision

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

input()

A

recieves user input

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

sep=

A

used in print() function to disable softspace feature (‘’). You can use it to add characteres between outputs.

e.g
print(‘G’, ‘F’, ‘G’, sep=’’) => GFG
print(‘09’, ‘12’, ‘2023’, sep=’-‘) => 09-12-2023

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

end=

A

end the output with a space

e.g

print(“ How are”, end = “”)
print(“ you ?”, end = “”)
=> How are you?

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

Type castings

A

convert a python datatype to another type

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

String slicing

A

var = “DAMILOLA”
var[2:5] = “MILO”
var[:5] = “DAMILO”
var[5:] = “OLA”

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

how can i print out quoutes

A

The backslashes protect the quotes, but are not printed.

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