Question
Fill out the code for the function that converts degrees, arcminutes and arcseconds into a decimal degree. What am I doing wrong?
1Convert deam al deg三degreest minutes160.tseoraslao. dび to-decoal (degreast minutes, seconds) return deoimal de
0 0
Add a comment Improve this question Transcribed image text
Answer #1

def convert_to_decimal(degrees,minutes,seconds):

#the problem with you code is

#the variables that are passed can be strings also

#so we need to cast them to floats

#otherwise everything is fine

decimaldeg = float(degrees)+float(minutes)/60+float(seconds)/3600

return decimaldeg

degrees=input("Enter degrees:")

minutes=input("Enter minutes:")

seconds=input("Enter seconds:")

print(convert_to_decimal(degrees,minutes,seconds))

print(convert_to_decimal(45,88,90))

output:

>>>

Enter degrees:45

Enter minutes:88

Enter seconds:90

46.4916666667

46.4916666667

//PLS give a thumbs up if you find this helpful, its helps me alot, thanks

decimal.py - C/Python30/ decimal.py File Edit Format Run Options Windows Help def convert_to_decimal (degrees, minutes, seconds): #the problem with you code is #the variables that are passed can be strings also #so we need to cast them to floats #otherwise everything is fine decimaldeg = float (degrees) +flo (minutes) /60+float (seconds) /3600 return decimaldeg degrees-input (Enter degrees:) minutes-input (Enter minutes:) seconds-input (Enter seconds: ) print (convert_to_decimal (degrees,minutes, seconds)) print (convert to decimal (45,88,90))

Add a comment
Know the answer?
Add Answer to:
Fill out the code for the function that converts degrees, arcminutes and arcseconds into a decimal...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • What is wrong with the following function definition? void fill(const int a[], int size) { for...

    What is wrong with the following function definition? void fill(const int a[], int size) { for (int i = 0; i < size; i++) {     a[i] = 0; } return; } Answers: The function cannot change the array parameter. The array should be passed as a call-by-reference, not call-by-value. The for loop causes an out-of-bounds indexing error. Nothing, the code works fine as is.

  • In (11): def convert time time in seconds) <Fill in the docstring for this function 0...

    In (11): def convert time time in seconds) <Fill in the docstring for this function 0 # <Add your code below. Note that the return value is currently arbitrary # Note that number format in the format string below> + hours = 5 minutes - 38 seconds = 12 designation - "PM" return "{:62d}: {:02d):{:02dH)".format( hours, minutes, seconds, designation # Tests print( convert time 7)) print convert time 2 • 60 60 + 7)) print( convert time( 12 * 60...

  • Please write the complete code in C. Write a C function that prints the minimum spanning...

    Please write the complete code in C. Write a C function that prints the minimum spanning tree of a graph. At the end, print the weight of the spanning tree. A suggested report format is shown in the following example. Source Vertex To Vertex Weight A B 2 A C 4 B D 3 D E 1 Total weight of spanning tree: 10 Your main program will read a graph from DataIn file to an adjacency table before calling the...

  • I can't figure out how to change my code to write info in from a text...

    I can't figure out how to change my code to write info in from a text file for the input. I'll post the context of the problem I am working on and the code I have finished so far. The program will create a Catapult object that will create a searchable matrix of trajectories for the given speeds and angles. The object should store these values in a 2D array. Given a target range of minimum and maximum distances, representing...

  • Write a function to dump the html content, and save it in the same directory of...

    Write a function to dump the html content, and save it in the same directory of your python script. The name of the saved html file should include the current time stamp. I currently have been trying this code. But Repl.it says "ModuleNotFoundError: No module named 'urllib2'". Could someone point out what i am doing wrong and help me include the current time stamp using 'datetime'. The format for the date and time should be YYYY_MM_DD_HH_MM_SS. import urllib2 def webpagedumb(url):...

  • Please HELP, I am stuck on this problem and I am not able to figure out...

    Please HELP, I am stuck on this problem and I am not able to figure out because the book is giving km/s instead of the regular km/h and the professor gives us the final answer to self check but my answer using the formula lambda=h/p is not the same as his answer...not sure what I am doing wrong. I tried to convert to m/s but that didn't work. What is the de Broglie wavelength of: a) an electron (m=9.1x10^-31kg) traveling...

  • 1. Outside temperature over a day can be modeled as a sinusoidal function. Suppose you know...

    1. Outside temperature over a day can be modeled as a sinusoidal function. Suppose you know the high temperature for the day is 82 degrees and the low temperature of 68 degrees occurs at 3 AM. Assuming t is the number of hours since midnight, find an equation for the temperature, D, in terms of t. D(t)= 2. A population of rabbits oscillates 18 above and below an average of 62 during the year, hitting the lowest value in January...

  • I am trying to figure out why my C code is outputting "exited, segmentation fault". The...

    I am trying to figure out why my C code is outputting "exited, segmentation fault". The game is supposed to generate 4 random numbers and store them in the "secret" array. Then the user is suppose to guess the secret code. The program also calculates the score of the user's guess. For now, I printed out the random secret code that has been generated, but when the game continues, it will output "exited, segmentation fault". Also, the GetSecretCode function has...

  • I am having a bit confusion trying to figure out the answers to these two questions....

    I am having a bit confusion trying to figure out the answers to these two questions. This test has a time limit of 2 hours. This test will save and submit automatica Warnings appear when half the time. 5 minutes, 1 minute, and 30 seconds attempts Not allowed. This test can only be taken once. pletion Once started, this test must be completed in one sitting Do not leave the tes ning Time: 1 hour, 33 minutes, 51 seconds. on...

  • Project 10-1 Convert lengths In this assignment, you’ll add code to a form that converts the valu...

    Project 10-1 Convert lengths In this assignment, you’ll add code to a form that converts the value the user enters based on the selected conversion type. The application should handle the following conversions: From To Conversion Miles - Kilometers: 1 mile = 1.6093 kilometers Kilometers - Miles: 1 kilometer = 0.6214 miles Feet - Meters: 1 foot = 0.3048 meters Meters - Feet: 1 meter = 3.2808 feet Inches - Centimeters: 1 inch = 2.54 centimeters Centimeters - Inches: 1...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT