How would I have an improper DMS value input return a message to the user in a Python 3 function? ...

Unexpected result with right shift after bitwise negation

What's the point in a preamp?

Why use gamma over alpha radiation?

Can a zero nonce be safely used with AES-GCM if the key is random and never used again?

What do you call a plan that's an alternative plan in case your initial plan fails?

If I can make up priors, why can't I make up posteriors?

Can a monk deflect thrown melee weapons?

What would be Julian Assange's expected punishment, on the current English criminal law?

Need a suitable toxic chemical for a murder plot in my novel

Antler Helmet: Can it work?

Estimated State payment too big --> money back; + 2018 Tax Reform

Does a C shift expression have unsigned type? Why would Splint warn about a right-shift?

Single author papers against my advisor's will?

New Order #5: where Fibonacci and Beatty meet at Wythoff

Is there a service that would inform me whenever a new direct route is scheduled from a given airport?

Writing Thesis: Copying from published papers

Replacing HDD with SSD; what about non-APFS/APFS?

Unable to start mainnet node docker container

If A makes B more likely then B makes A more likely"

How to say 'striped' in Latin

Problem when applying foreach loop

How does modal jazz use chord progressions?

Is there folklore associating late breastfeeding with low intelligence and/or gullibility?

How to colour the US map with Yellow, Green, Red and Blue to minimize the number of states with the colour of Green



How would I have an improper DMS value input return a message to the user in a Python 3 function?



Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?NBI Coordinate Data Missing place-holding zeroes for DMS formatHow to normalize the data mapped on a shapefile in GeoPandas when polygons do not have the same sizeHow to use the 'to_dms' function in a CRS conversion expression in QGIS?How to preserve the Multiploygons using Python?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















My question is about input functions in python 3 specifically for a conversion function from dms to dd.



I'm new to python3 and having some trouble understanding how I would allow a user to input their DMS coordinate and have them limited by a 0-90 range, so if they put something like 100, or -1, the code would return a statement asking them to input a valid DMS format.



Below is my code - I think my if statement is where the trouble is happening. When I'm indicating if variable(x,x,x) - would that indicate the format the user would need to input their coordinate in?



def dms_convert_to_dd(degrees, minutes, seconds):
dd = degrees + float(minutes) / 60 + float(seconds) / 3600
return dd

dms = input('Please enter your DMS coordinate: ')
if dms_convert_to_dd(degrees, minutes, seconds) in range(0, 90):
print(dd)
else:
print("Please enter correct DMS coordinates")









share|improve this question























  • 100 degrees is valid for longitude, as is 180, -1, and -180. Your conversion function will not generate correct results in the western or southern hemisphere, and your validity test only considers integer values.

    – Vince
    9 mins ago




















0















My question is about input functions in python 3 specifically for a conversion function from dms to dd.



I'm new to python3 and having some trouble understanding how I would allow a user to input their DMS coordinate and have them limited by a 0-90 range, so if they put something like 100, or -1, the code would return a statement asking them to input a valid DMS format.



Below is my code - I think my if statement is where the trouble is happening. When I'm indicating if variable(x,x,x) - would that indicate the format the user would need to input their coordinate in?



def dms_convert_to_dd(degrees, minutes, seconds):
dd = degrees + float(minutes) / 60 + float(seconds) / 3600
return dd

dms = input('Please enter your DMS coordinate: ')
if dms_convert_to_dd(degrees, minutes, seconds) in range(0, 90):
print(dd)
else:
print("Please enter correct DMS coordinates")









share|improve this question























  • 100 degrees is valid for longitude, as is 180, -1, and -180. Your conversion function will not generate correct results in the western or southern hemisphere, and your validity test only considers integer values.

    – Vince
    9 mins ago
















0












0








0








My question is about input functions in python 3 specifically for a conversion function from dms to dd.



I'm new to python3 and having some trouble understanding how I would allow a user to input their DMS coordinate and have them limited by a 0-90 range, so if they put something like 100, or -1, the code would return a statement asking them to input a valid DMS format.



Below is my code - I think my if statement is where the trouble is happening. When I'm indicating if variable(x,x,x) - would that indicate the format the user would need to input their coordinate in?



def dms_convert_to_dd(degrees, minutes, seconds):
dd = degrees + float(minutes) / 60 + float(seconds) / 3600
return dd

dms = input('Please enter your DMS coordinate: ')
if dms_convert_to_dd(degrees, minutes, seconds) in range(0, 90):
print(dd)
else:
print("Please enter correct DMS coordinates")









share|improve this question














My question is about input functions in python 3 specifically for a conversion function from dms to dd.



I'm new to python3 and having some trouble understanding how I would allow a user to input their DMS coordinate and have them limited by a 0-90 range, so if they put something like 100, or -1, the code would return a statement asking them to input a valid DMS format.



Below is my code - I think my if statement is where the trouble is happening. When I'm indicating if variable(x,x,x) - would that indicate the format the user would need to input their coordinate in?



def dms_convert_to_dd(degrees, minutes, seconds):
dd = degrees + float(minutes) / 60 + float(seconds) / 3600
return dd

dms = input('Please enter your DMS coordinate: ')
if dms_convert_to_dd(degrees, minutes, seconds) in range(0, 90):
print(dd)
else:
print("Please enter correct DMS coordinates")






python-3 degrees-minutes-seconds






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 11 mins ago









ChrisChris

215




215













  • 100 degrees is valid for longitude, as is 180, -1, and -180. Your conversion function will not generate correct results in the western or southern hemisphere, and your validity test only considers integer values.

    – Vince
    9 mins ago





















  • 100 degrees is valid for longitude, as is 180, -1, and -180. Your conversion function will not generate correct results in the western or southern hemisphere, and your validity test only considers integer values.

    – Vince
    9 mins ago



















100 degrees is valid for longitude, as is 180, -1, and -180. Your conversion function will not generate correct results in the western or southern hemisphere, and your validity test only considers integer values.

– Vince
9 mins ago







100 degrees is valid for longitude, as is 180, -1, and -180. Your conversion function will not generate correct results in the western or southern hemisphere, and your validity test only considers integer values.

– Vince
9 mins ago












0






active

oldest

votes












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "79"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f318765%2fhow-would-i-have-an-improper-dms-value-input-return-a-message-to-the-user-in-a-p%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f318765%2fhow-would-i-have-an-improper-dms-value-input-return-a-message-to-the-user-in-a-p%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Щит и меч (фильм) Содержание Названия серий | Сюжет |...

Венесуэла на летних Олимпийских играх 2000 Содержание Состав...

Meter-Bus Содержание Параметры шины | Стандартизация |...