Python Forum
creating two points (x,y) and adding them together..
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
creating two points (x,y) and adding them together..
#3
You probably want this to create the points:

def createPoints():
    x1 = int(input ('Enter a value x of point a '))
    y1 = int(input ('Enter a value y of point a '))
    x2 = int(input ('Enter a value x of point b '))
    y2 = int(input ('Enter a value y of point b '))

    return [[x1, y1], [x2, y2]]
To add the points:

def additionAB (points):
    c = points[0][0] + points[1][0], points[0][1] + points[1][1]
    return c
The call them

print(additionAB(createPoints()))
Reply


Messages In This Thread
RE: creating two points (x,y) and adding them together.. - by ghoul - Nov-20-2021, 07:22 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Adding graph points and formating project_science 4 2,499 Jan-24-2021, 05:02 PM
Last Post: project_science
  How can I scroll over my data points when creating plots in Python? (I'm using Spyder moose 0 1,656 Nov-02-2020, 07:18 AM
Last Post: moose
  Adding markers to Folium map only adding last element. tantony 0 2,198 Oct-16-2019, 03:28 PM
Last Post: tantony
  Issue with ginput and adding points to an exisiting plot gaminer 0 1,673 Oct-12-2019, 07:08 PM
Last Post: gaminer

Forum Jump:

User Panel Messages

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