如何使数字之间的数组范围?

时间:2019-01-09 18:25:44

标签: python arrays python-3.x pseudocode

我想使数字在数组中范围内。

例如(用伪代码):

**StudentNames** [1:30]           <---- numbers from 1 to 30

如何在数字之间建立数组范围?

2 个答案:

答案 0 :(得分:0)

这是你想要的:

studentNames = list(range(1,31))

所以现在您有一个类似...的列表

[1, 2, 3, 4, ... 30]

您可以将值更改为学生想要的任何值。

答案 1 :(得分:0)

假设library(shiny) library(shinyWidgets) ui <- fluidPage( pickerInput("id", "Formatting changes", multiple=T, choices = sample(LETTERS, size = 10), options = list(`actions-box` = TRUE, `live-search` = TRUE, `selected-text-format`= "static", title = "Commodity List"), choicesOpt = list( style = rep(("color: black; background: lightgrey; font-weight: bold;"),10))) ) server <- function(input, output){} shinyApp(ui, server) 已经是大小为StudentNamesn> = 30的数组。您可以执行以下操作

n