lundi 10 mai 2021

How do you process 1 variable that gives 2 arguments (in the form of a tuple) in a function?

I am trying to write a function where "c" is the variable for which coordinates are entered in the form of a tuple. However, I am unable to get this program to work because I keep getting the error: TypeError: inside_or_outside() takes 1 positional argument but 2 were given.

def inside_or_outside(c):
    
    l1 = float(52 + 4/60 + 52/3600) 
    b1 = float(5 + 9/60 + 49/3600)
    
    l2 = float(52 + 5/60 + 28/3600)
    b2 = float(5 + 11/60 + 4/3600)
    if (l1 < c[0] and b1 < c[0]) and (l2 > c[1] and b2 > c[1]):
        print("inside")
    else:
        print("outside") 
    return 


print(inside_or_outside(52.0234325, 5.8469786))

This is because I enter the coordinates in a pair of longitude and latitude for the variable c. For example, I want to be able to enter the following coordinates for the variable c: (52.0234325, 5.8469786). All coordinates are given in the variable c, but unfortunately this is not possible at the moment, does anyone have an idea to fix this?

Aucun commentaire:

Enregistrer un commentaire