Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x = float(input("Enter the value of x: "))
- if x < 0:
- print("The value of y is -5.")
- elif x >= 0 and x < 1:
- y = x + 2
- print(f"The value of y is {y}.")
- elif x >= 1 and x < 5:
- y = 3 * x - 1
- print(f"The value of y is {y}.")
- else:
- y = 2 * x
- print(f"The value of y is {y}.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement