Skip to content

Commit

Permalink
Rewrite 'countLines' function.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aermoss committed Dec 25, 2024
1 parent 3d0c27c commit af656c9
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions example.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import sys, os, sdl3, ctypes, colorsys, time

def countLines() -> int:
lines = 0

for i in os.listdir("sdl3"):
if i.endswith(".py"):
with open(f"sdl3/{i}", "r") as file:
lines += file.read().count("\n") + 1

return lines
return sum([open(f"sdl3/{i}", "r").read().count("\n") + 1 for i in os.listdir("sdl3") if i.endswith(".py")])

def main(argv: list[str]) -> int:
print(f"total lines of code: {countLines()}.")
Expand Down

0 comments on commit af656c9

Please sign in to comment.