File size: 396 Bytes
b092c58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import math


def apply_file_naming_convention(text):
    """Apply file naming conventions to a string."""
    text = text.replace("(", '"').replace(")", '"')
    return text.replace('"', "-").replace(" ", "_")


def order_of_magnitude(number):
    """Return the order of magnitude of a number."""
    if number == 0:
        return 0
    else:
        return math.floor(math.log10(abs(number)))