Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialPeter Reichl
Front End Web Development Techdegree Student 12,217 PointsFunctions in Swift Challenge: Return a complex value
My code works in a playground, but I get a non-specific error message. When I click on preview to see the errors, the output is empty. What am I missing?
// Enter your code below
func coordinates(for location: String) -> (Double, Double) {
var lat: Double = 0.00
var lon: Double = 0.00
switch location {
case "Eiffel Tower":
(lat = 48.8582, lon = 2.2945)
case "Great Pyramid":
(lat = 29.972, lon = 31.1344)
case "Sydney Opera House":
(lat = 3.8587, lon = 151.2140)
default:
(0,0)
}
return (lat, lon)
}
coordinates(for: "Eiffel Tower")
3 Answers
Jennifer Nordell
Treehouse TeacherHi there! You're actually doing fantastic. The problem here is simply a pair of typos. The latitude for "Sydney Opera House" and "Great Pyramid" are incorrect, so it's getting back a faulty latitude.
The latitude for "Sydney Opera House" is supposed to be 33.8587 but you typed 3.8587. Note the missing 3 at the beginning. On the "Great Pyramid", the latitude should be 29.9792 but you typed 29.972. Note the missing 9 towards the end between the 7 and 2.
No problems here besides a couple of typos and that happens to those who think faster than they type
Hope this helps!
Peter Reichl
Front End Web Development Techdegree Student 12,217 PointsYes, very good advice: I need to slow down some times. It works perfectly now. Thanks for the quick response, Jennifer!
NAVEED CHOWDHURY
1,142 PointsThanks for posting this , although this is not part of the challenge I want to know how you can make the code non sensitive to both Upper Case and Lower Case when the user writing the input.