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]:
In [ ]:
function iseven_f(x)
if (x % 2) == 0
print("чётное")
else
print("нечётное")
end
end # комментарий
Out[0]:
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