library(learnr)
library(gradethis)
library(tidyverse)
library(reticulate)
library(gradethispython) # exercise checker for R exercises
tutorial_options(exercise.checker = gradethis::grade_learnr)
d <- 2

Python

```{python df} mpg = r.mpg

The expected answer is the `mpg` dataset from R. This exercise uses `gradethispython::py_grade_learnr` for checking solution.

```{python ex1, exercise=TRUE, exercise.setup = "df", exercise.checker = gradethispython::py_grade_learnr}
mpg

```{python ex1-check} python_grade_result( python_pass_if(mpg, "You also got the mpg dataframe!"), python_fail_if(None, "Remember to return the right dataset!"), )

```{python ex1-solution}
mpg

R

mpg
gradethis::grade_code(
  correct = "Good job!"
)
mpg
gradethis::grade_result(
  pass_if(~ identical(.result, mpg), "You also got the mpg dataframe"),
  fail_if(~ TRUE, "Oops!")
)


nischalshrestha/gradethispython documentation built on May 9, 2022, 5:17 p.m.