This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shutil | |
shutil.copy('../fff/Chicago.jpg','../mmm/image2.jpg') | |
#시카고 이미지를 mmm폴더의 imgage2로 저장하겠다. | |
shutil.move('../mmm/image2.jpg','../fff/Chicago2.jpg') | |
#mmm폴더의 image2를 다시 fff폴더에 Chicago2이름으로 이동 | |
-------------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#readline()함수 | |
#한글을 읽으려면 꼭 utf-8을 잊지말자. | |
fa=open('../fff/aaa.txt','r', encoding='utf-8') | |
dd=fa.read() | |
fa.close() | |
print(dd) | |
#한글을 읽으려면 꼭 utf-8을 잊지말자. | |
fa=open('../fff/stud.csv','r') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ../는 이걸 나가겠다. 뜻임 | |
# 줄을 바꾸고 싶다면 역슬러쉬를 항상 그어줘야 한다. | |
f = open('../fff/aaa.txt','w') | |
f.write('query') | |
f.write('aaa') | |
f.write('bbb\n') | |
f.write('ccc') | |
f.close() | |
# 한글이 안깨졌으면 좋겠다. 기본이 utf-8이다. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def computepay(h,r): | |
if h<=40: | |
pay=h*r | |
elif h>40: | |
pay=40*r+(h-40)*r*1.5 | |
return(pay) | |
hrs = input("Enter Hours:") | |
h = float(hrs) | |
rate = input("Enter rate:") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
score = input("Enter Score: ") | |
try: | |
s=float(score) | |
except: | |
print('error') | |
quit() | |
if s>=0.9: | |
print('A') | |
elif s>=0.8: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#평균이 90점이상인 경우에만 '수' | |
#모든 과목이 90점이상이라면 수 옆에 초우등생 | |
name = "샛별" | |
kor = 91 | |
eng = 81 | |
mat = 95 | |
sum = kor+eng+mat | |
avg = sum/3 | |
result = '수' if avg >= 90 else '우' \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
score=78 | |
if score>=80: | |
pass | |
print("의사소견:", '뇌는 있네') | |
print('없는 줄 알았잖아') | |
IQ = '동물수준' | |
result = '우수라고 해줄게' | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x=17 | |
y=7 | |
print(x+y) | |
print(x-y) | |
print(x/y) | |
print(x**y) | |
print(x//y) | |
print(x%y) | |
print(1==3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ff = "911117-2360600" | |
year = int(ff[:2]) #91 | |
gender = int(ff[8]) #2 | |
country = int(ff[9:11]) #60 | |
result1 = '1990년대' if year<=99 else '2000년대' | |
result2 = '여자' if not gender%2 else '남자' | |
result3 = '내국인' if country<=90 else '외국인' | |
print('판단:', result1, result2, result3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i=0 | |
while i<10: | |
print("시작:", i) | |
i += 1 | |
if i==5: | |
continue | |
print("끝:", i) | |
i=0 | |
while i<10: |