파이썬의 컬렉션과 반복문
1. 리스트와 for문li1 = ['apple', 'banana', 'orange', 'melon']for i in li1: print(i, end = ' ') score = [90, 30, 50, 60, 80, 70, 100, 40, 20, 10]count = 0for i in score: if i >= 60: count += 1print(f'60점 이상인 학생의 수는 {count}명입니다') 2. 딕셔너리와 for문dic1 = {'no':1, 'userid':'apple', 'name':'김사과', 'hp':'010-1111-1111'}for i in dic1: print(i, end= ' ' )딕셔너리는 for문에서 i 값에 키(Key)만 들어간다. for문을 사용할 때 ...
2024. 9. 26.