본문 바로가기

분류 전체보기17

[python3] 계절 n = int(input())if n == 3 or n ==4 or n ==5:    print('spring')elif n == 6 or n ==7 or n ==8:    print('summer')elif n == 9 or n ==10 or n ==11:    print('fall')elif n == 12 or n ==1 or n ==2:    print('winter')else:    print('잘못된 데이터입니다') 3spring 2022. 6. 15.
[python3] 밀리세컨드 second = int(input('초를 입력하세요:')) hour = 60*60minute = 60 hours = int(second//hour)second %= hour.                      #second 에서 hour을 나누었을때 나머지를 구하여 second에 할당 minutes = int(second//minute)second %= minute print('%d시-%d분-%d초입니다.'%(hours, minutes, second))  초를 입력하세요:12345534시-17분-35초입니다. 2022. 6. 15.
[python3] 거스름돈 payment = int(input())cost = int(input())change = payment - costft = int(change/5000)change = change - ft*5000ot = int(change/1000)change = change - ot*1000print(f'거스름돈은 {payment - cost}원 입니다.')print(f'5000원 지폐:{ft}장, 1000원 지폐:{ot}장 받았습니다.') 2200010000거스름돈은 12000원 입니다.5000원 지폐:2장, 1000원 지폐:2장 받았습니다. 2022. 6. 15.
[python3] 고무공 높이 계산 1.height = 100bounce = 3/5i = 1while i     height = height * bounce    print(i, round(height, 4))    i = i + 1 2.h = 100 For i in range (1, a+1):       h = h*0.6       print(h) 2022. 6. 15.
[python3] 369 게임 1.  a = int(input("숫자를 입력하세요:"))for i in range(1,a+1):    s = str(i)    count = 0    for j in s:        if (j =='3') or (j =='6') or (j == '9'):            count += 1    if count == 0:        print(i, end = " ")       else:        i = '#' * count                               #3, 6, 9 부분에 표시할 문자.           print(i, end=" ") 2. def claps(number):    num_str = str(number)    count_claps = 0    cou.. 2022. 6. 15.