mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-07 19:46:30 +08:00
Pyupgrade to Python 3.9 (#4718)
* Pyupgrade to Python 3.9 * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@ -19,7 +19,7 @@ class HashTable:
|
||||
return self._keys
|
||||
|
||||
def balanced_factor(self):
|
||||
return sum([1 for slot in self.values if slot is not None]) / (
|
||||
return sum(1 for slot in self.values if slot is not None) / (
|
||||
self.size_table * self.charge_factor
|
||||
)
|
||||
|
||||
|
@ -14,7 +14,7 @@ class HashTableWithLinkedList(HashTable):
|
||||
|
||||
def balanced_factor(self):
|
||||
return (
|
||||
sum([self.charge_factor - len(slot) for slot in self.values])
|
||||
sum(self.charge_factor - len(slot) for slot in self.values)
|
||||
/ self.size_table
|
||||
* self.charge_factor
|
||||
)
|
||||
|
Reference in New Issue
Block a user