iOS Functions in Swift Adding Power to Functions Returning Complex Values

Tariq Qazzaz
Tariq Qazzaz
1,660 Points

Missing Somthing in my Tuple ?

Hi Guys // Enter your code below func coordinates (for location:String) -> (Double,Double) {

switch location { case "Eiffel Tower" : return (48.8582 , 2.2945) case "Great Pyramid" : return (29.97922 , 31.1344) case "Sydney Opera House" : return (33.8587 , 151.2140) default : return (0.0 , 0.0) }

}

i couldnt find the problem in my code ..

would you please help me

functions.swift
// Enter your code below
func coordinates (for location:String) -> (Double,Double) {

  switch location {
  case "Eiffel Tower"       : return (48.8582 , 2.2945)
  case "Great Pyramid"      : return (29.97922 , 31.1344)
  case "Sydney Opera House" : return (33.8587 , 151.2140)
  default                   : return (0.0 , 0.0)
  }

}

2 Answers

Jennifer Nordell
STAFF
Jennifer Nordell
Treehouse Staff

Hi there! You simply have a typo in one of the values you're returning. The problem is with the value returned by "Great Pyramid".

// You typed 
return (29.97922 , 31.1344)

// That should be 
return (29.9792 , 31.1344)

Note the removal of the extraneous 2 on the latitude of the second version.

Hope this helps! :sparkles:

Tariq Qazzaz
Tariq Qazzaz
1,660 Points

Awww .. thank you so much . appreciate it .

István Halász
István Halász
2,896 Points

Hi, you only mistyped the Great Pyramids' coordinates. Instead of writing (29.9792, 31.1344), you wrote (29.97922 , 31.1344). You just wrote an extra 2 :)

Tariq Qazzaz
Tariq Qazzaz
1,660 Points

thank you so much .. it worked . easy mistake got me stuck for 30 minutes .