# Define a function called concat
def concat(**kwargs):
"""Concatenates keyword arguments into a single string with spaces."""
result = ""
# Iterate over the Python kwargs
for kwarg in kwargs.items():
result += " " + kwarg
return result
# Call the function
print(concat(start="Python", middle="is", end="great!"))
kwargs.iter() → dict has no attribute 'iteration'
파이썬3에는
iter()메서드 존재하지 않는다.items(),keys(),values()가 iterator와 유사한 view 객체를 반환한다.
kwargs.items() → can only concatenate str (not tuple) to str
kwargs.items()를 반복문으로 돌리면 각 요소는 (key, value) 형태의 튜플로 반환된다. result는 문자열인데, 문자열에 튜플을 더하려고 해서 위와 같은 에러가 발생한 것이다.
kwargs.values()를 사용해서 value만 뽑아 문자열로 사용하면 해결되는 문제였다.
valueerror : 제공된 값이 허용 가능한 범위에 있지 않을 때
float('hello') : float는 문자열을 받기도 하는데, hello를 바꿔줄 숫자 값이 없다.git revert
git revert -n HEAD-n : no commit--no-edit만약 단일 파일만 되돌리고 싶다면 → git checkout
git checkout HEAD~1 -- report.md
staging 영역에 있는 파일을 되돌리고 싶다면? → unstaging
git restore --staged summary_statistics.csvgit restore --stagedflat file : 구조화된 관계가 없는 레코드