Skip to content

Commit

Permalink
solving conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Safi222 committed Jan 12, 2025
1 parent 49ea586 commit f648c98
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions solutions/copy_from_file_to_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ def copy_file_to_file(source_file: str, destination_file: str) -> None:
"""
# Defensive checks
assert os.path.exists(
source_file
), f"Error: Source file '{source_file}' doesn't exist."
assert source_file.endswith(
".txt"
), f"Error: Source file '{source_file}' is not a .txt file."
assert destination_file.endswith(
".txt"
), f"Error: Destination file '{destination_file}' is not a .txt file."
assert os.path.exists(source_file), (
f"Error: Source file '{source_file}' doesn't exist."
)
assert source_file.endswith(".txt"), (
f"Error: Source file '{source_file}' is not a .txt file."
)
assert destination_file.endswith(".txt"), (
f"Error: Destination file '{destination_file}' is not a .txt file."
)

# Copy operation: Open the source file in read mode
with open(source_file, "r") as file_from:
Expand Down
6 changes: 3 additions & 3 deletions solutions/word_count_from_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ def word_count_txt_file(file_name) -> int:

# Defensive assertions
assert os.path.exists(file_name), f"Error:file '{file_name}' doesn't exist"
assert file_name.endswith(
".txt"
), f"Error: The file '{file_name}' does not have a .txt extension."
assert file_name.endswith(".txt"), (
f"Error: The file '{file_name}' does not have a .txt extension."
)

# Open the file safely
f = open(file_name, "r")
Expand Down

0 comments on commit f648c98

Please sign in to comment.