스파르타 AI-8기 TIL(9/27)
Reiterate statement
1. for
Ex. for a in [1,2,3]
print(a)
result:
1
2
3
2. while
I = 0
while I < 3:
I = I + 1
print(I)
result
1
2
3
Def function
Ex.
def add(a, b): -> add(a,b) -> receiver
return a + b
add(3,4) -> add(3,4) input
result:
7
"" and ''
"Python is easy" -> Python is easy
"Python's favorite" -> Python's favorite
' "Python is easy," she said ' -> "Python is easy," she said
Can use \
"\"Python is very easy.\" he says" -> "Python is very easy," he says
When putting multiple lines into variable (\n or "' "' or ''' ''')
or
or
result
->
I need to read
Because I have to
Tips
\n -> changing line
\t -> giving a space
\\ -> just to show \ itself
\' -> to show '
\" -> to show "
string addition or multiplication
a = "python"
b = "is good"
print ->
a + b -> python is good
a * 2 -> pythonpython
Index Slicing
Ex.
result -> py
Meaning 0:2 -> get the text from 0 to 1(not include end number)
or can skip 0
result -> pyt
or
If I want to get all the texts
result -> python
I don't have to write the number
or I also can use -
result -> tho
From tomorrow, I have to watch the videos again..
Good night