Menu
Coddy logo textTech

Naming convention

Lesson 16 of 28 in Coddy's Clean Code - Write better code using Python course.

PEP 8 follows the suggested Python naming convention as we saw before :

TypeConventionExample
Variablesnake_case all lower casegenerated_result
Functionsnake_case all lower caseprint_info()
Constantsnake_case all upper casePI = 3.14
ClassCamelCaseMyClass
modulesnake_case all lower casenumpy
challenge icon

Challenge

Easy

You are given with some PEP 8 naming conventions violations can you spot & fix them?

Try it yourself

class soul:
	free_string = 'Soul freed'  # const string
	def __init__(self, NAME):
		self.NAME = NAME
	
	def Free(self):
		print(self.free_string + ' - ' + self.NAME)

if __name__ == '__main__':
	instance = soul('John Doe')
	instance.Free()

All lessons in Clean Code - Write better code using Python