Hello! I am working on making a game for students to practice estimating the standard deviation of a set of data using a histogram and a given sample size.

How could I incorporate the sd(x) stored in y (line 50; two asterisks surrounding) into lines 55-58 (three asterisks surrounding) for the logical ifelse statement (since they are within different output command sequences)?

Secondly, how could I get the code to regenerate new values for lines 44-49 (one set of asterisks surrounding) each time a student selects a new sample size.

```
library(shiny)
ui <- fluidPage(
titlePanel("Standard Deviation Estimation Practice"),
# Sidebar with a slider input for sample size
sidebarLayout(
sidebarPanel(
sliderInput("samplesize", h3("Enter a positive whole number as a sample size"), min = 10, max = 500, value = 250),
submitButton("Submit"),
numericInput("guess", "What is your estimation of the standard deviation of the data in the histogram?", ""),
submitButton("Submit")
),
# Show a plot of the generated distribution and pose question
mainPanel(
plotOutput("distPlot"),
textOutput("result")
)
)
)
server <- function(input, output)({
output$distPlot <- renderPlot({
*
seed1 <- sample.int(1000000, 1)
set.seed(seed1)
sd1 <- sample.int(25, 1)
mean1 <- sample((-300):400, 1)
x <- rnorm(n = input$samplesize, mean = mean1, sd = sd1)
**y <- sd(x)** *
# draw the histogram with the specified number of bins
hist(x, main = "Histogram", xlab = "Sample Values", ylab = "Frequency Count", col = 'darkgray', border = 'white')
})
output$result <- renderText({
***ifelse(q >= (y - 0.5), ifelse(q <= (y + 0.5),
"That is a correct estimation! Good job! Enter a new sample size.",
"That estimate is too big. Try again!"),
"That estimate is too small. Try again!")***
})
})
shinyApp(ui = ui, server = server)
```

Thank you for your help!