typing_test/typing_test.py
def calculate_cpm(self, time_played):
        """Calculate CPM given time_played in seconds"""
        if time_played == 0:
            return 0

        correct_chars = len(" ".join(self.correct))
        cpm = 60 / time_played * correct_chars
        cpm = int(round(cpm))
        return cpm
Calculate CPM given time_played in seconds
Calculate CPM given time_played in seconds
Calculate CPM given time_played in seconds
def calculate_cpm(self, time_played):
        if time_played == 0:
            return 0
        correct_chars = len(" ".join(self.correct))
        cpm = 60 / time_played * correct_chars
        cpm = int(round(cpm))
        return cpm
def calculate_cpm ( self , time_played ) : if time_played == 0 : return 0 correct_chars = len ( " " . join ( self . correct ) ) cpm = 60 / time_played * correct_chars cpm = int ( round ( cpm ) ) return cpm
Calculate CPM given time_played in seconds
Calculate CPM given time_played in seconds
"""Calculate CPM given time_played in seconds"""
self
time_played