If문 활용 pocket=['paper','money','cellphone'] if 'money' in pocket: pass #조건을 만족할 경우 아무것도 실행하지 않음 else: print('카드를 꺼내라') if 'money' in pocket: pass else: print('카드를 꺼내라') #조금 더 간결한 조건문 #조건부 표현식 message='success' if score>=60 else 'failure' 2. while문 활용 #홀수만 출력 a=0 while a<10: a+=1 if a%2==0: continue #2로 나누었을 때 나머지가 0이면 처음으로 돌아감 print(a) 3. for문 활용 #for문과 continue marks=[90,25,67,45,80] number=0 for mark in marks: number+=1 if mark<60: continue print('%d번 학생 축하합니다. 합격입니다.'
%number) #List comprehen...
원문 링크 : 제어문 기본함수