Engee documentation
Notebook

Fundamentals of algorithms and programmes

To begin, please start the preparatory code cell.

In [ ]:
Pkg.add(["HttpCommon", "EzXML"])
In [ ]:
# Установка новой библиотеки может занять около минуты
using HttpCommon, EzXML
print("Библиотеки готовы!")
Библиотеки готовы!

Calculating the value of a simple mathematical expression

Calculate the value of the expression $y = sin(x) + 13^x$ at the point $x = 2.1$.

In [ ]:
y = sin(2.1) + 13^2.1
Out[0]:
219.27749467860951

edu_algo_example1.png

In [ ]:
function iseven_f(x)
    if (x % 2) == 0
        print("чётное")
    else
        print("нечётное")
    end
end # комментарий
Out[0]:
f (generic function with 2 methods)

Function check

In [ ]:
iseven_f(3)
нечётное
In [ ]:
iseven_f(2)
чётное

Conclusion in a loop the results of HTML timing analysis

A string with HTML code is given:

<td valign="top">First</td><td width="580" valign="top">Second</td><td>Third</td>

Print in the loop the text of all elements td, whose property valign equals top.

In [ ]:
txt = """<td valign="top">Первый</td><td width="580" valign="top">Второй</td><td>Третий</td>"""
doc = parsehtml(txt)

html = root(doc)
xpath = "//td[@valign=\"top\"]"

for el in findall(xpath, html)
    print(el)
end
<td valign="top">Первый</td><td width="580" valign="top">Второй</td>