Final Words
Lesson 27 of 28 in Coddy's Clean Code - Write better code using Python course.
Clean Code is an integral part of coding.
Hopefully now you have an overview of what clean code is, and how you can implement it in Python.
Your task now is to integrate the principles you have learned with your day to day coding to enjoy all the benefits of clean code!
Challenge
EasyLet's recap everything!
You are given a code which violates variety of clean code principles, find them and refactor the code!
Try it yourself
from abc import ABC
from abc import abstractmethod
class convertor(ABC):
@abstractmethod
def Convert(self):
pass
class binary_convertor(convertor):
def __init__(self, number):
self.number = number
def Convert(self):
return bin(self.number)[2:]
if __name__ == '__main__':
NUMBER = eval(input())
CONVERTOR = binary_convertor(NUMBER)
print(CONVERTOR.Convert())