Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.1 kB
1
Indexable
Never
"""
ohjelmointi 1 syksy 2021
sampo perunka
"""

def print_box(w , h , m):
    """
    tulostaa laatikon
    :param w:
    :param h:
    :param m:
    :return:
    """

    width = int(w)
    height = int(h)

    for height in range(0 , h):
        for width in range(0 , w):
            print(m , end="")
        print()

def read_input(kysymys): #  float or int
    """
    virheentarkastusfunktio
    :param kysymys:
    :return:
    """
    while True:
        asd = input(kysymys)
        try:
            asd = int(asd)
            if asd > 0:
                return asd
            else:
                pass
                #  print("Input cannot be negative")

        except ValueError:
            pass
            #  print("Bad input")


def main():
    width = read_input("Enter the width of a frame: ")
    height = read_input("Enter the height of a frame: ")
    mark = input("Enter a print mark: ")

    print()
    print_box(width, height, mark)


if __name__ == "__main__":
    main()