For this quiz, the goal is to see that you understand lists
and can define a procedure that uses them.
You'll be given a variable, daysinmonth,
which is initialized to a list containing 12 entries
where each entry is the number of days in the corresponding month,
so January has 31 days, so that's why we have 31 here.
February--at least in a non-leap year--has 28 days.
March has 31, and so on up to December that has 31 days.
Your goal is to define a procedure called howmanydays--
with underscores between the words--
that takes as input a number representing a month
and outputs the number of days in that month,
and we should use the conventional way of numbering the months,
so here's a few examples.
If we call howmanydays, passing in 1,
meaning the month January, the output should be 31
since there are 31 days in January,
and that corresponds to the entry in the zeroth position of daysinmonth.
If we call howmanydays, passing in 9, that's September.
We should get 30.
Per questo quiz, l'obiettivo è vedere se capisci le liste
e puoi definire una procedura che le usi.
Ti viene data una variabile "daysinmonth",
inizializzata a una lista contenente 12 valori
dove ognuna rappresenta il numero di giorni del mese corrispondente
e Gennaio ha 31 giorni, così abbiamo 31 qui.
Febbraio -- almeno in un anno non bisesitle -- ha 28 giorni.
Marzo 31, e così via fino a Dicembre che ne ha 31.
Il tuo obiettivo è definire una procedura chiama "howmanydays" [quanti giorni]
-- con "_" fra le parole --
che prende in ingresso un numero che rqappresenta un mese
e restituisce il numero di giorni di quel mese,
e dovremmo usare il modo convenzionale di numerare i mesi,
Ecco alcuni esempi
Se chiamiamo "howmanydays" passando 1,
intendendo Gennaio, il risultato dovrebbe essere 31
perchè ci sono 31 giorni in Gennaio
e questo corrisponde alla "zeresima" posizione di "daysinmonth"
Se chiamiamo "howmanydays", passando 9, questo è Settembre.
Dovremmo ottenere 30.
リストを使うための関数を定義できるか
小テストをしましょう
リストdays_in_monthがあります
12のエントリが設定されていますが
この数字は12の月が有する日数の数です
1月は31日まであるので31です
2月はうるう年でなければ28日ですね
3月は31日です これが12月まで続きます
how_many_daysという名の関数を定義してください
入力は月に該当する数字で出力はその月の日数です
月をナンバリングする従来の方法を
使用する必要があります
いくつか例を挙げます
how_many_daysを呼び出し1を渡せば
出力は31になります
1月には31日あるからです
days_in_monthのゼロの位置にある
エントリに一致します
how_many_daysを呼び出し
9月を意味する9を渡せば
30を取得するはずです
Neste teste, o objetivo é ver se voc6e entende listas,
e se pode definir um procedimento que usa listas.
Suponha dada uma variável days_in_month,
que é iniciada com uma lista contendo 12 entradas,
cada entrada correspondendo ao número de dias do mês correspondente.
Então, Janeiro tem 31 dias -- por isso temos 31 aqui.
Fevereiro, em um ano que não seja bissexto, tem 28 dias.
Março tem 31, e assim por diante, até Dezembro, que tem 31 dias.
Sua tarefa é definir um procedimento chamado how_many_days --
com _ entre as palavras --
que recebe como entrada um número, representando um mês,
e produz como saída o número de dias deste mês,
e ele deve usar a maneira convencional de numerar os meses.
Aqui estão alguns exemplos.
Se chamamos how_many_days, passando 1 --
o que significa o mês de Janeiro -- a saída deve ser 31,
já que exsitem 31 dias em Janeiro,
e isso corresponde à entrada na posição 0 de days_in_month.
Se chamamos how_days_days, passando 9 -- isto é, Setembro --
devemos obter 30.
对于这个测验 其目的是看看你对列表的理解如何
及可以定义一个可以用到它们的函数
你会有一个变量 days_in_mouth
其被初始化给一个包含12个元素的列表
每个元素为对应月份的天数
那么一月有31天 这就是为什么这里是31
二月-至少在非闰年-有28天
三月有31天 接着直到有31天的十二月
你的目标是定义一个函数叫 how_many_days
有着下划线在每个单词间-
其接收一个代表月份的数字
输出那个月的天数
接着我们应该用通常的方式数月份
这里有一些例子
如果我们调用 how_many_days 传给它1
意思是一月份 输出应该为31
既然一月份有31天
在 days_in_month 列表中的对应位置为第零个
如果我们调用 how_many_days 传入9 就是9月份
我们应该得到30
這次測驗的目標,是要看看你是否了解列表 (list)
並且是否能定義一個使用列表的程序
給了變數 days-in-month
初始值是一個包含了 12 項元素的列表
每項元素表示對應月份的天數
1 月有 31 天,所以這裡是 31
平年的 2 月有 28 天
3 月有 31 天,以此類推一直到 12 月有 31 天
你的目標是定義程序 how-many-days
字詞之間有底線
輸入是代表月份的數字
輸出是那個月份的天數
我們使用傳統的方法來數月份
舉例來說
如果我們呼叫 how-many-days,傳入 1
表示 1 月,輸出應該是 31
因為 1 月有 31 天
31 是這個列表中第 0 個位置的元素
如果我們呼叫 how-many-days,傳入 9 ,表示 9 月
應該得到 30