fork download
  1. def licz(x):
  2. return x + 1 if x < 0 else x if x<=1 else x**2 + 1
  3.  
  4. for i in range(-4, 4):
  5. x = i * 0.5
  6. print(f"f({x}) = {licz(x)}");
Success #stdin #stdout 0.02s 9320KB
stdin
Standard input is empty
stdout
f(-2.0) = -1.0
f(-1.5) = -0.5
f(-1.0) = 0.0
f(-0.5) = 0.5
f(0.0) = 0.0
f(0.5) = 0.5
f(1.0) = 1.0
f(1.5) = 3.25