Advertisement
endzie_fyrge

[29] The Value of Y

Aug 8th, 2019
511
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. x = float(input("Enter the value of x: "))
  2.  
  3. if x < 0:
  4.     print("The value of y is -5.")
  5. elif x >= 0 and x < 1:
  6.     y = x + 2
  7.     print(f"The value of y is {y}.")
  8. elif x >= 1 and x < 5:
  9.     y = 3 * x - 1
  10.     print(f"The value of y is {y}.")
  11. else:
  12.     y = 2 * x
  13.     print(f"The value of y is {y}.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement