Function
def 함수 이름(parameter #1, ... ):
수행문 #1(statement)
수행문 #2(statement)
return <반환값>
-
Formatting
%-format : "%datatype"%(variable)
print("I eat %d apples. " % 3)
str.format() : "{datatype}".format(argument)
print("My name is {0} and {1} years old.".format(name,age))
fstring : f"{var name}"
print(f"hello, {name}. You are {age}.")
'부스트캠프 AI Tech > Python' 카테고리의 다른 글
Pythonic code (0) | 2022.01.19 |
---|---|
Data Structure (0) | 2022.01.19 |
String (0) | 2022.01.19 |
Conditionals and loops (0) | 2022.01.18 |
Variable & Memory (0) | 2022.01.18 |