Google Technical Writing Course - 2
프로그래밍 언어 하나를 선택해서 `for` loops에 대한 튜토리얼 작성하기.
스니펫을 적절히 활용하고, 타겟 독자는 다음 중 하나를 고른다.
프로그래밍 언어에 대해 처음 접하며 아직 loops에 대해 모르는 학생들.
하나 이상의 프로그래밍 언어를 알고 있으며, 해당 프로그래밍 언어를 새로 배우는 학생들. 예를 들어 C나 C++에 대해서 알고 있으나 이제 파이썬을 처음 배우는 학생들.
튜토리얼 간소화를 위해, 타겟 독자는 하기와 같은 선수지식이 이미 있다고 가정한다:
소스코드를 입력하고 수정하는 법.
프로그램을 실행하는 법.
변수를 선언하고, 변수에 값을 할당하는 법. (→ a = 3)
변수 값이나 문자열 출력하는 법. (→ print)
타겟 독자는 프로그래밍 언어 자체가 처음이며 아직 loops에 대해 모르는 학생들로 잡았고,
언어는 python으로 하기로 했다.
따라서 학생들은 위의 선수지식에 괄호 안에 따로 표시한 부분에 대해 이미 알고 있고, 해당 명령문을 사용해서 example을 바로 작성할 수 있다.
아래와 같이 개요를 먼저 작성해보았다.
## About this tutorial
- Audience -> 이 글은 파이썬으로 처음 프로그래밍 언어에 입문하는 사람을 대상으로 함.
Prerequisites -> 앞서 위의 선수지식을 미리 배웠다고 가정. 아직 모른다면 아래 링크를 클릭해 개념을 미리 익히고 올 것.
## What is loops
- contrast (using example)
-> loop를 사용할 때와 사용하지 않는 예시
## for loops in python
- How to use -> 문법, snippet : for A in list
- Example -> A = [1, 2, 3, 4, 5] + print 사용
### Break, Continue 등 부연설명
그리고 개요를 바탕으로 작성한 튜토리얼은 아래와 같다. 아예 문제에서 제시된 2가지 후보 독자를 모두 포함하는 걸로 바꿨다.
This tutorial introduce the concept of loops in programming and explains how to use for loops in python.
This tutorial is for students learning Python as their first programming language. If you already know one or more programming languages, you can directly go to for loops in python.
This tutorial doesn't explain below items. If you are not familiar with those topics, study them first before proceeding.
Enter and modify source code.
Execute programs.
Create variables and assign values to those variables.
Output variable values and constant strings.
In programming, loops execute one or more statements up to desired number of times. If you use the loop, you don't have to repeat same statements multiple times.
For example, if you want to print "Hello" 5 times, you have to write as below without a loop:
/* Below is pseudo-code and not a specific programming language */
print Hello
print Hello
print Hello
print Hello
print Hello
If you use the loop, you can simplify the code as below:
for component in list:
Most of programming languages provide loops, and there are various forms of loops. For example, in Python, you can use either for or while loops depending on your purpose.
A python for loop is used to iterate over a sequence (e.g. a list, tuple, string, or range) or other iterable objects, executing a block of code for each item in the sequence. Basic syntax is as bloew:
for item in iterable:
# Code block to be executed for each item
The for loop does not require an indexing variable to set beforehand.
For example, you can print elements in a list as below.
fruits = ["apple", "banana", "cherry"]
for x in fruits:
print(x)
Output:
apple
banana
cherry
Also, you can use for loops for strings as below:
message = "Hello"
for char in message:
print(char)
Output:
H
e
l
l
o
You can use the range() function for a specified number of iterations. The range() function starts from 0 and increments by 1 by default until the loop has repeated a set number of times.
For example, you can put the specific number as below:
for x in range(3):
print(x)
Output:
0
1
2
... (이하 생략)
아래는 비슷한 포맷으로 설명이 이어져서 생략.
Live session에서 피드백을 주고받으며 했으면 좋았을텐데 아쉽다.
찾아보니 Facilitator을 위한 자료도 있는 것 같은데, 추후에 그걸 다운받아서 참고해보려고 한다.
어쨌든 여기까지 해서 Technical Writing Course 끝!
이 다음에 Tech Writing for Accessibility라는 코스도 있는데, 이건 student 자료는 따로 없는 것 같다.
마찬가지로 Facilitator 자료만 있어서, 나중에 기회가 되면 한번 다시 봐야겠다.
출처 : https://developers.google.com/tech-writing/twol/tutorials