Python Forum
Help! Program in python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help! Program in python
#2
Help?? An emergency?

You don't need the module math for this!

Something like this maybe?? I don't really understand this number formatting!

print('Enter the X and Y coordinates for the point:')
x = float(input('Enter X = '))
y = float(input('Enter Y = '))
if x < -1 or x > 4:
    flag = 0 #False
# complicated elif hard to understand 
elif x>=-1 and x<1 and y>=2*x+2 and y<=x**3 - 4*x**2+x+6 or x>=1 and x<=4 and y>=x**3-4*x**2+x+6 and y<=2*x+2:
    flag = 1
else:
    flag = 0
print("Point X = {:.4f} Y={:.4f})".format( x, y ))
 
if flag:
    print(f"The point  {(x, y)} is within the graph borders")
else:
    print(f"The point {(x, y)} is outside of the area")
lana likes this post
Reply


Messages In This Thread
Help! Program in python - by lana - Oct-08-2023, 04:37 PM
RE: Help! Program in python - by Pedroski55 - Oct-08-2023, 05:52 PM
RE: Help! Program in python - by lana - Oct-08-2023, 06:00 PM
RE: Help! Program in python - by Pedroski55 - Oct-08-2023, 07:10 PM
RE: Help! Program in python - by ICanIBB - Oct-11-2023, 01:30 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020