목록Zerobase DS School (34)
log.Sehee

반복문 5gear_a = int(input('GearA 톱니수 입력: '))gear_b = int(input('GearB 톱니수 입력: '))a, b = gear_a, gear_bcount = 0while a != b: count += 1 if b % gear_a != 0: b = gear_b * count b_count = count a = gear_a * count print(f'gearA: {a}, gearB: {b}')print(f'최초 만나는 톱니수(최소공배수): {b}톱니')print(f'gearA 회전수: {count}회전')print(f'gearB 회전수: {b_count}회전') 반복문 6for i in range(2021, 2032): ..

연산자 1product_price = int(input('상품 가격 입력: '))payment_price = int(input('지불 금액: '))change = (payment_price - product_price) // 10 * 10money = [50000, 10000, 5000, 1000, 500, 100, 10]print(f'거스름 돈: {change}(원단위 절사)')print('-' * 30)for i in money: if i >= 1000: print(f'{i:,d} {change//i}장') else: print(f'{i} {change//i}개') change %= iprint('-' * 30) 연산자 2score = {'국어': 0, ..

데이터와 변수 1name = 'zb'product = '음료수'order_no = 2351124pay_method = '신용카드'product_price = 10000pay_price = 9000use_point = 1000payDate = '2023/11/22 16:29:22'pay_div = 6pay_dic_category = '무'phone = '02-1234-5678'print(name, '고객님 안녕하세요.')print(name, '고객님의 주문이 완료되었습니다.')print('다음은 주문건에 대한 상세 내역입니다.')print('-'*50)print('상품명\t:', product)print('주문번호\t:', order_no)print('결제방법\t:', pay_method)print('상품..
조건식 / if문if 조건식: print('true') # 조건식이 참일 때 실행else: print('false') # 조건식이 참이 아닐 때 실행# (참인 경우 실행코드) if (조건식) else (참이 아닐 경우 실행코드)result = print('true') if 1 > 2 else print('false') # false 조건식 / + elifif 조건식1: print('조건식1이 참이다') # 조건식1이 참일 경우 출력elif 조건식2: print('조건식2가 참이다') # 조건식1이 거짓이며 조건식2가 참일 경우 출력else: print('조건식 모두 참이 아니다') # 조건식1과 조건식2 모두 참이 아닐 경우 출력 조건문 중첩age = 20if age > 13:..