You have to program several functions. In each case, few lines of code are enough.
Write a function @drawH(n)@ that given an odd integer
prints a letter H of size
formed with symbol . Follow the pattern of the example below.
Write a function @area_circle(r)@ that given a float number
returns, rounded to the hundredth, the area of the circle of radius
.
Use the pi constant defined in the math
module.
Write a function @slow_pi_aprox(n)@ that given a non negative integer computes rounded to the hundredth.
Write a function @is_univariate_number(n)@ that given a non negative integer returns a boolean pointing out whether is represented using only one digit. For instance is univariate but is not.
Write a boolean function @is_univariate_word(s)@ that given an
string
returns True if and only if
is formed using only one letter. For instance word
xxXxXXx is univariate but
xxXxy is not. We assume
is non empty and all characters of
are letters.
Every function counts 20 points.
>>> drawH(5) * * * * ***** * * * * >>> area_circle(2.5) 19.63 >>> slow_pi_aprox(50) 3.16 >>> is_univariate_number(22322) False >>> is_univariate_word("xxXxXXx") True