2022-10-11 19:27:51 +00:00
|
|
|
# Esta função implementa g(x) = 8 - x**3
|
2023-01-30 16:48:43 +00:00
|
|
|
def g(x):
|
2023-05-16 20:00:37 +00:00
|
|
|
return 8 - x ** 3
|
2023-01-30 16:48:43 +00:00
|
|
|
|
2022-10-11 19:27:51 +00:00
|
|
|
|
|
|
|
# Defina uma função que implemente p(x) = x**2 + 2x + 3
|
2023-01-30 16:48:43 +00:00
|
|
|
def p(x):
|
2023-05-16 20:00:37 +00:00
|
|
|
return x ** 2 + 2 * x + 3
|
2023-01-30 16:48:43 +00:00
|
|
|
|
2022-10-11 19:27:51 +00:00
|
|
|
|
|
|
|
def main():
|
|
|
|
# Mostra alguns valores da função g:
|
|
|
|
print("g(1) =", g(1))
|
|
|
|
print("g(2) =", g(2))
|
|
|
|
print("g(10) =", g(10))
|
|
|
|
|
|
|
|
# Acrescente instruções para mostrar os valores de
|
|
|
|
# p(1), p(2), p(10) e g(1 + p(3)).
|
2022-10-18 17:18:56 +00:00
|
|
|
print(f"""
|
|
|
|
p(1) = {p(1)}
|
|
|
|
p(2) = {p(2)}
|
|
|
|
p(10) = {p(10)}
|
|
|
|
g(1 + p(3)) = {g(1 + p(3))}
|
|
|
|
""")
|
2022-10-11 19:27:51 +00:00
|
|
|
|
2023-01-30 16:48:43 +00:00
|
|
|
|
2022-10-11 19:27:51 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|