"""CSCA08 Files Worksheet: starter code.
"""

from typing import TextIO


def is_correct(dict_file: TextIO, word: str) -> bool:
    """Return True if and only if word is in dict_file.
    Note: current position in dict_file will change as a result of the call.

    Pre: word is not empty
         dict_file is open for reading,
                   current position at the beginning of the file

    >>> with open('dictionary.txt') as dict_file:
    ...     is_correct(dict_file, 'Zyrtec')
    True
    >>> with open('dictionary.txt') as dict_file:
    ...     is_correct(dict_file, 'lolz')
    False
    """

    pass


def write_ascii_triangle(outfile: TextIO, block: str, sidelength: int) -> None:
    """Write an ascii isosceles right triangle using block that is sidelength
    characters wide and high to outfile. The right angle should be in the
    upper-left corner.

    Precondition: len(block) == 1
                  sidelength >= 0
                  outfile is open for writing

    For example, given block="@" and sidelength=4, the following
    should be written to the file:

    @@@@
    @@@
    @@
    @

    """

    pass


if __name__ == '__main__':
    import doctest
    doctest.testmod()

    with open('triangle.txt', 'w') as triangle_file:
        write_ascii_triangle(triangle_file, '@', 5)

    with open('triangle2.txt', 'w') as triangle_file_2:
        write_ascii_triangle(triangle_file_2, 'x', 10)
