![[Python] 조건문 연습4](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F1ruXt%2FbtsHjArh3yL%2Fd4a0c4f6GZwJvIzdafnZ01%2Fimg.png)
- PC가 난수(1 ~ 1000)를 발생하면 사용자가 숫자(정수)를 입력한다 - 사용자가 난수를 맞추면 게임이 종료된다. - 만약, 못 맞추게 되면 난수와 사용자 숫자의 크고 작음을 출력한 후 사용자한테 다시 기회를 준다. - 최종적으로 사용자가 시도한 횟수를 출력한다. import randomrandomNum = random.randint(1, 1000)tryCnt = 0gameFlag = Truewhile gameFlag: tryCnt += 1 userNum =int(input('1에서 1,000까지의 정수 입력: ')) if randomNum == userNum: print('정답!') gameFlag = False else: ..
![[Python] 조건문 연습3](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FYwYuc%2FbtsHieWWMkI%2FKG4RTkRxflMk9XknKhfO9k%2Fimg.png)
미세먼지 비상저감조치로 차량 운행제한 프로그램 만들기 - 미세먼지 측정 수치가 150이하면 차량 5부제 실시 - 미세먼지 측정 수치가 150을 초과하면 차량 2부제 실시 - 차량 2부제를 실시하더라도 영업용차량은 5부제 실시 - 미세먼지 수치, 차량 종류, 차량 번호를 입력하면 운행 가능 여부 출력 import datetimetoday = datetime.datetime.today()day = today.daylimitDust = 150dustNum = int(input('미세먼지 수치 입력: '))carType = int(input('1.승용자 | 2. 영업용차 >>> '))carNum = int(input('차량 번호 입력: '))print('*' * 50)print(t..
![[Python] 조건문 연습2](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcWltOS%2FbtsHgZ0oHW6%2FIs06oFSe0GX1repUgcsko0%2Fimg.png)
난수를 이용해서 가위, 바위, 보 게임 import randomcomNum = random.randint(1, 3)userNum = int(input('1. 가위 | 2. 바위 | 3. 보 (숫자입력) >>> '))if ((comNum == 1 and userNum == 2) or (comNum == 2 and userNum == 3) or (comNum == 3 and userNum == 1)): print('컴퓨터는 {}번! '.format(comNum), end='') print('컴퓨터 패!')elif comNum == userNum: print('컴퓨터는 {}번! '.format(comNum), end='') print('무승부!!')else: ..
![[Python] 조건문 연습1](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FueQrr%2FbtsHgfvKwjz%2FRpFr1dyMD3YFvJIgJqRGPK%2Fimg.png)
국어, 영어, 수학, 과학, 국사 점수를 입력하면 총점을 비롯한 각종 데이터가 출력되는 프로그램 - 과목별 점수를 입력하면 총점, 평균, 편차를 출력 평균은 다음과 같다. (국어: 85, 영어: 82, 수학: 89, 과학: 75, 국사: 94) - 각종 편차 데이터는 막대그래프로 시각화 avgKor = 85; avgEng = 82; avgMath = 89; avgSciece = 75; avgHistory = 94sum = avgKor + avgEng + avgMath + avgSciece + avgHistoryavg = sum / 5kor = int(input('국어: '))eng = int(input('영어: '))math = int(input('수학: ')..