Engee documentation
Notebook

Fundamentals of algorithms and programs

First, please run the preparation cell with the code.

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

Calculating the value of a simple mathematical expression

Calculate the value of the expression at the point .

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)

Checking the function

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

Conclusion of HTML analysis results in a cycle-deadlines

The line with the HTML code is given:

<td valign="top">First</td><td width="580" valign="top">The second</td><td>The third</td>

Print the text of all the elements in the loop td, which have the property valign equally 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>