[파이썬 연습문제] for문 리스트 - 합계와 평균 구하기 scores = [100,50,60,88,45,99,35,48,87] sum = 0 for sc in scores : sum += sc avg = sum/8 print('총점 : %d, 평균 : %.2f' % (sum, avg)) 총점 : 612, 평균 : 76.50 출처: 예제 중심 파이썬 입문 • programming language/python 2022.07.12
[파이썬 연습문제] for문 리스트 - 리스트 요소 반복하기 fruits = ['apple', 'orange', 'banana'] for fruit in fruits : print(fruit) apple arange banana 출처: 예제 중심 파이썬 입문 • programming language/python 2022.07.12