summaryrefslogtreecommitdiffstats
path: root/ExampleSubmission/example.py
blob: a226adbea387b095e9c4b8753cb590571ac96730 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Eden Attenborough
# 12-01-21

import tkinter as tk

class Application(tk.Tk):
    """An example class, which implements a GUI by inheriting from tkinter.Tk
    """
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.title("Hello World!")

    def a_method_with_defaults(self, n:str, arg_1 = "hello", arg_2 = "world", count:int = 3):
        """Adds two strings together with a space between them.

        Args:
            arg_1 (str, optional): The first string to add. Defaults to "hello".
            arg_2 (str, optional): The second string to add. Defaults to "world".

        Returns:
            str: A concatinated string.
        """
        return "%s %s" % (arg_1, arg_2)

    def add(self, num1:int, num2:int) -> int:
        """Adds two numbers together and returns the output

        Args:
            num1 (int): The first number to add
            num2 (int): The second number to add

        Returns:
            int: The two numbers added together
        """
        return num1 + num2

# hello world!
def hello_world(times):
    """Prints 'hello world!' to stdout. Prints it out `times` times.

    Args:
        times (int): The number of times to print out hello world.

    Returns:
        str: Hello world, repeated as many times as nessicary
    """
    return "hello world! " * 3

def an_undocumented_function():
    return 3.14156

# kwonlyargs demo
def greet(*names, greeting="Hello"):
    for name in names:
        print(greeting, name)

if __name__ == "__main__":
    app = Application()
    app.mainloop()