G
G
Gulnara2020-05-03 20:40:24
Python
Gulnara, 2020-05-03 20:40:24

How to program a function in Python?

5eaf01d53d500960169640.png
I don't understand what the problem is.

import math
a = 4.5
x = -1.9
print("y = f(x):\n\t| y = math.tan(a)+x, если x < 0\n\t| \
y = math.(2*a)**0.5-math.sin(x), если 0 < = x < =1\n\t| y = x**3-a**3, если x > 1")
if x < 0:
  y = y = math.tan(a) + x
elif 0 <= x <= 1:
  y = math.(2 * a) ** 0.5 - math.sin(x)
elif x > 1:
  y = x ** 3 - a ** 3
pint(y)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sanya Hihi Haha, 2020-05-03
Atayeva @nari8884

Curators will be shocked by this xD

import math
a=4.5
x=-1.9
print("y = f(x):\n\t| y = math.tan(a)+x, если x < 0\n\t| \
y = math.(2*a)**0.5-math.sin(x), если 0 < = x < =1\n\t| y = x**3-a**3, если x > 1")
if x < 0:
    y  = math.tan(a)+x
    print(y)
elif 0 <= x <= 1:
    y = (2*a)**0.5-math.sin(x)
    print(y)
elif x >1:
    y = x**3-a**3
    print(y)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question