Check Code _ Day of the Race Project

Hello, could please help find what is wrong with my code below?

race_results <- c(“Gi”, “Francesca”, “Lea”, “Vivian”, “Jessica”, “Esther”, “Mary”, “Yasmina”, “Megan”, “Janet”, “Tiffany”, “Kishan”, “Feng”, “Z”, “Tina”)


```{r}

# write find_place() here:

find_place <- function (runner) {

  for (place in 1:length(race_results)) {

    if race_results[place] == runner {

      return place

    }

  }

  return 0

}


# call and apply find_place() here:

print(find_place("Francesca"))`Preformatted text`







**You must select a tag to post in this category. Please find the tag relating to the section of the course you are on**

When you ask a question, don't forget to **include a link** to the exercise or project you're dealing with!

If you want to have the best chances of getting a useful answer quickly, make sure you **follow our guidelines** about how to [ask a good question](http://bit.ly/usecodecademyforumsbetter).  That way you'll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer! :slight_smile:

Hello @cferreira264! Are there any errors being thrown, and what are the criteria? Could you post those as well, please?

Can I get my code checked as well please?


title: “Day of the Race”

output: html_notebook



# create friends vector here:

friends = c("Megan", "Janet", "Tina")


# add on to the list here:

info_list <- list(

  Esther = list(

    jersey = 3432,

    color = "purple"

  ),

  Feng = list(

    jersey = 4221,

    color = "blue"

  ),

  Megan = list(

    jersey = 1363,

    color  = "green"

  ),

  Janet = list(

    jersey = 6729,

    color = "green"

  ),

  Tina = list(

    jersey = 7501,

    color = "orange"

  )

)


print_information <- function(name) {

  print(paste(name, "is #", info_list[[name]]$jersey, "wearing the color", info_list[[name]]$color))

}

# call the print_information function on the friends vector:

# print_information("Megan")

# print_information("Janet")

# print_information("Tina")

for (e in friends){

  print_information(e)

}


race_results <- c("Gi", "Francesca", "Lea", "Vivian", "Jessica", "Esther", "Mary", "Yasmina", "Megan", "Janet", "Tiffany", "Kishan", "Feng", "Z", "Tina")


# write find_place() here:

find_place = function(runner){

  for (place = 1; place < race_results.length; place++){

    if (race_results[[place]]= runner){

      return (place)

    } else {

      return (0)

    }

  } 

}

find_place("Lea")


# call and apply find_place() here:

ERROR Message:
processing file: notebook.Rmd
Quitting from lines 55-67 (notebook.Rmd)
Error in parse(text = x, srcfile = src) : :3:14: unexpected ‘=’
2: find_place = function(runner){
3: for (place =
^
Calls: … -> parse_all -> parse_all.character -> parse
Execution halted

1 Like