Created
June 9, 2022 00:28
-
-
Save brunokim/af35afdf2e4cd73ba20a252d5841c01e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_file(num_elements: int, size: int, filename: str) -> int: | |
with open(filename, 'w') as f: | |
total = 0 | |
while total < size: | |
value = random.randrange(num_elements) | |
total += f.write(f'{value}\n') | |
return total |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment