[파워 유저를 위한 파이썬express] 6장 프로그래밍 programming 솔루션 답지
1. n = int(input("입력할 값의 개수: ")) result = [ ] for i in range(n): value = int(input("")) result.append(value) s = sum(result) print("값의 합계=", s) 3. numbers = [20, 1, 12, 9, 18] for value in numbers: print(value, "\t", "*" * value) 5. def match_words(words): ctr = 0 for word in words: if len(word) > 1 and word[0] == word[-1]: ctr += 1 return ctr s= ['aba', 'xyz', 'abc', '121'] print(s) print('문자열의..
2023. 1. 8.
[파워 유저를 위한 파이썬express] 5장 프로그래밍 programming 솔루션 답지
1. def get_peri(radius = 5.0): p = 2.0*3.141692* radius return p print(get_peri()) # 기본 인수 사용 print(get_peri(4.0)) 3. def calc(a, b): return a+b, a-b, a*b, a/b x = int(input("첫 번째 정수를 입력하시오: ")) y = int(input("첫 번째 정수를 입력하시오: ")) a,b,c,d = calc(x, y) print(a, b, c, d, "가 반환되었습니다") 5. def checkpassword(s): digit, lower, upper = 0, 0, 0 for i in s: if i.isupper(): upper = 1 elif i.islower(): lower..
2023. 1. 8.