Python Lab (3)
1) Please write a function named triangle, which draws a triangle of
hashes, and takes one argument. The triangle should be as tall and
as wide as the value of the argument.
Some examples:
triangle(6)
triangle(3)
#
##
###
####
#####
######
#
##
###
2) Please write a function named greatest_number, which takes three
arguments. The function returns the greatest in value of the three.
[without using max function, and solve it in two ways]
print(greatest_number(3, 4, 1)) # 4
print(greatest_number(99, -4, 7)) # 99
print(greatest_number(0, 0, 0)) # 0
3) Write a function sum_series(n) that calculates the sum of the
series:
1 - 2 + 3 - 4 + 5 - ... up to n
4) Write a Python function to calculate the factorial of a number (a
non-negative integer). The function accepts the number as an
argument.
5) Implement a function that checks if a given word is a palindrome
(reads the same forwards and backwards)