Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 어노테이션
- springjdbc
- 비즈니스레이어
- 생성자주입
- spring
- .xml
- @Valid
- produces
- 스프링
- Model
- application.properties
- 유효성검사
- 서비스레이어
- @RequestMapping
- MVC
- 의존주입
- SpringBoot
- AOP
- frontController
- gradle
- Java
- springmvc
- 바인딩변수
- @ResponseBody
- jointpoint
- c:if
- after-throwing
- @RequestParam
- PointCut
- @
Archives
- Today
- Total
메모장
파이썬 [ 능력단위 평가 실습 ] 본문
728x90
반응형
✔️ 문제
- 정확한 입력시 그래프 출력
- 잘못된 입력 시 '해당 이름을 가진 동은 없습니다.' 출력
- 데이터 2개 이상 나올 시 '해당 이름을 가진 동이 여러개입니다!' 출력

✅ 슈도코딩
▪️ "역삼" 입력된 검색어가 들어가는 동 모두 출력
▪️ 몇번만에 성공 할지 모르니 while
▪️ 해당 동이 2개 이상이라면 " 해당동이 여러개 입니다!" 출력
▪️ 해당 동이 1개가 되도록 맞게 입력하였다면 "역삼1동" break
import csv
import matplotlib.pyplot as plt
import numpy as np
while True:
with open('korea.csv','r') as file:
data=csv.reader(file)
header=next(data)
print()
area=input('동 이름 입력>> ')
city=[]
for row in data:
if area in row[0]:
city.append(row[0])
sample=np.array(row[3:], dtype=int)
print(row[0])
if not city:
print('해당 이름을 가진 동은 없습니다.')
elif len(city) ==1:
break
else:
print('해당 이름을 가진 동이 여러개입니다!')
print('정확하게 입력해주세요!')
plt.plot(sample)
plt.show()
728x90
반응형
'Python > 개념정리' 카테고리의 다른 글
| 파이썬 numpy [ 실습 4 ] (0) | 2024.05.30 |
|---|---|
| 파이썬 [ 능력단위 평가 실습 2 ] (0) | 2024.05.14 |
| 파이썬 numpy [ 실습 3 ] (0) | 2024.05.14 |
| 파이썬 numpy [ 실습 2 ] (0) | 2024.05.14 |
| 파이썬 numpy [ 실습 ] (0) | 2024.05.14 |