Night 15: Loud and quiet
이미 Python 또는 의사 코드로 이날의 학습을 마쳤습니다. 두 언어 모두에서 완료한 것으로 인정됩니다. 원하면 다시 연습하세요.
이 페이지는 최신 브라우저(SharedArrayBuffer 지원)가 필요합니다. Chrome, Edge, Firefox 또는 Safari를 최신 버전으로 업데이트해 주세요.
English
Tonight: loud and quiet
- Welcome to week 3: words and secrets!
- Tonight your pet speaks loud and quiet.
- You will learn one thing: functions for text.
Words for tonight
| Word | Meaning |
|---|---|
| upper case | capital letters: A B C |
| lower case | small letters: a b c |
| length | how many characters are in a text |
English
Loud and quiet
TO_UPPERandTO_LOWERtake a text and give a new text back.
DECLARE Word : STRING
Word ← "Hello"
OUTPUT TO_UPPER(Word)
OUTPUT TO_LOWER(Word)
OUTPUT Word
Worditself does not change.- 9618 also has
UCASEandLCASE, but they take one character. For a whole word, useTO_UPPERandTO_LOWER.
English
Count the characters
LENGTHcounts the characters in a text. Spaces count too.
DECLARE Name : STRING
Name ← "Lumi"
OUTPUT LENGTH(Name)
OUTPUT LENGTH("Good night")
| Text | LENGTH |
|---|---|
"Kit" |
3 |
"Good night" |
10 |
"" |
0 |
English
Compare without worrying about capitals
- In pseudocode,
"YES"and"yes"are different. - Make both lower case, then compare:
DECLARE Answer : STRING
Answer ← "YES"
IF TO_LOWER(Answer) = "yes" THEN
OUTPUT "OK!"
ENDIF
- Now make your pet shout and whisper!
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
Your pet shouts! Read a word with INPUT Word. Output it in capital letters with ! after it. hello becomes HELLO!.
출력을 보려면 '실행'을 클릭하세요.
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
Now your pet whispers. Read a word and output it in small letters. HELLO becomes hello.
출력을 보려면 '실행'을 클릭하세요.
난이도 2/5 · 140코인 + 오늘 첫 완료 시 작은 보너스 추가
Read a name. Output the name, has, the number of letters, and letters. For Kit the output is Kit has 3 letters.
출력을 보려면 '실행'을 클릭하세요.
난이도 2/5 · 140코인 + 오늘 첫 완료 시 작은 보너스 추가
Read two words. If they are the same word, even with different capitals (YES 및 yes), output Same!. Otherwise output Different.
출력을 보려면 '실행'을 클릭하세요.