# Python tips
# Inline Conditions
print(f'{j} * {i} = {j*i if j*i>9 else " "+str(j*i)}', end = ' ' )
1
# Print Format
Useful when you want even spacing for your outputs.
print("{0:_<10}".format(500))
# 500_______
print("{0: >10}".format(500))
# 500
# Allows you to get free 10 space.
# Component inside formate will be placed in given(10) space.
# If component goes over given space, component will not be cut.
weight = 68.6
print(f'{weight:.6f}')
# 68.600000
s.ljust(n) # align left with total of n spacing
s.center(n)
s.rjust(n)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20