in Education by
I started learning python a few months back, so i don't know alot of terms still. This program fetches co-ordinates from a text file and finds out which point is closest to the user input. the co-ordinates are listed lat,lon,cityname of course i'm suprised that it can't find the variables, but i'm even more suprised that it found one but not the others. I would be greatful if someone could explain to me why it can't find them. points=open_points.read() text_length_unfilt=len(points) text_lenth=text_length_unfilt/3 cit_point = points.split(",") #importing all of the items from math now from math import radians from math import atan2 from math import cos from math import sin from math import sqrt #this allows the user to imput two numbers, one for lat, one for lon. lat1=float(input("What is the Latatude of your point in degrees? ")) lon1=float(input("That's great. Now in degrees, what is the Longitude? ")) #function to reduce clutter def calc_dist(lat1,lon1,lat2,lon2): #this part converts the degrees into radians for the equation lon1 = radians(lon1) lat1 = radians(lat1) lon2 = radians(lon2) lat2 = radians(lat2) #here i'm just using the equation from the rubrik a = sin((lat1 - lat2) / 2) ** 2 + cos(lat1) * cos(lat2) * sin((lon1 - lon2) / 2) ** 2 c = 2 * atan2(sqrt(a), sqrt(1 - a)) distance = 3958.8 * c return(distance) and this is the error i get. cit_dist=calc_dist((lat1, lon1, lat2, lon2)) TypeError: calc_dist() missing 3 required positional arguments: 'lon1', 'lat2', and 'lon2' JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
cit_dist=calc_dist((lat1, lon1, lat2, lon2)) The error is because you are using double parentheses. (lat1, lon1, lat2, lon2) is treated as a single tuple.

Related questions

0 votes
    I am totally new to Machine Learning and I have been working with unsupervised learning technique. Image shows my ... 3 were given Select the correct answer from above options...
asked Feb 1, 2022 in Education by JackTerrance
0 votes
    I don't understand which accuracy in the output to use to compare my 2 Keras models to see which one is better. ... - val_acc: 0.7531 Select the correct answer from above options...
asked Feb 1, 2022 in Education by JackTerrance
0 votes
    When I try to generate a model with acumos I get this error : File "/Users/fredericchantrel/.pyenv/ ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 14, 2022 in Education by JackTerrance
0 votes
    This my my JSON: { "maps": [ { "id": "AT", "iscategorical": "0" }, { "id": "AT", "iscategorical": "0 ... the values, How can I do it? Select the correct answer from above options...
asked Jan 22, 2022 in Education by JackTerrance
0 votes
    I want to upload the file pdf to the folder but a file is not saved to a folder. I already read the ... .run(debug=True)``` Select the correct answer from above options...
asked Jan 19, 2022 in Education by JackTerrance
0 votes
    I am originally a C programmer. I have seen numerous tricks and "hacks" to read many different arguments. What are ... can do this? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    I am starting to work with python again after 8 years. I am trying to do the program with BeautifulSoup and an ... '__main__': main() Select the correct answer from above options...
asked Jan 19, 2022 in Education by JackTerrance
0 votes
    I've recently seen quite a bit of the following pattern in Python: class Foo: pass class Bar: ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 2, 2022 in Education by JackTerrance
0 votes
    Jupyter notebooks (Python) return the value of the last variable in a cell in a pretty printed format. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 20, 2022 in Education by JackTerrance
0 votes
    I'm working on a mini text role playing game where you must survive dinner with the king. I'm ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 8, 2022 in Education by JackTerrance
0 votes
    I'm trying to make a function that will compare multiple variables to an integer and output a string of three ... like this possible? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    In a function, How to create and use a global variable? How can I use it in other functions? Is it compulsory ... it in a function? Select the correct answer from above options...
asked Jan 24, 2022 in Education by JackTerrance
0 votes
    I have a python variable how can I see that it's unsigned 32 bit or signed 16 bit, etc? Select the correct answer from above options...
asked Jan 22, 2022 in Education by JackTerrance
0 votes
    This is my code it's just starting the scan but it is not completing ,where is the error in it. ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 26, 2022 in Education by JackTerrance
0 votes
    How to check which Python version is interpreting my script? Select the correct answer from above options...
asked Jan 23, 2022 in Education by JackTerrance
...