python case convention code example
Example 1: python naming conventions
import mymodule
my_variable = 'value'
CONSTANT = 'never changes'
class MyClass(self):
pass
Example 2: switch statements python
def week(i):
switcher={
0:'Sunday',
1:'Monday',
2:'Tuesday',
3:'Wednesday',
4:'Thursday',
5:'Friday',
6:'Saturday'
}
return switcher.get(i,"Invalid day of week")
print(week(5))
Example 3: pep8
my_list = [
1, 2, 3,
4, 5, 6,
]
result = some_function_that_takes_arguments(
'a', 'b', 'c',
'd', 'e', 'f',
)
Example 4: class name convention python
class MyClass:
def __init__(self):
self.load_time = 25
def print_value(self, value):
print(value)