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
s1 = set([1,2,3,4,5,6]) | |
s2 = set([4,5,6,7,8,9]) | |
uu = s1|s2 | |
ii = s1&s2 | |
mm = s1-s2 | |
uu=s1.union(s2) | |
ii=s1.intersection(s2) | |
mm=s1.difference(s2) |
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
list1 = [11,33,22,77,11,33,77,22,11,66] | |
s1 = set(list1) | |
s2 = set((234,567,890,987,234,11,890)) | |
print(list1) | |
print(s1) | |
print(s2) | |
s2.add(22) | |
s2.update([4455,6677,1122,7788]) | |
print(s2) | |
s2.remove(6677) |
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
hap=0 | |
i = 0 #초기값 | |
while i <= 10: | |
print("아기 상어", i) | |
hap+=i #hap에 계속 누적을 하는 것이다. | |
i+=1 #증감 | |
print(hap) | |
#0~200까지 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
i=0 | |
while True: | |
if i==10: | |
break #딱 10일때 정확히 stop되고, 더이상 프린터를 하지 않는다. | |
print("아기 상어",i) | |
i+=1 | |
print("종료") | |
print('-----input-------') |
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: |
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
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
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
#평균이 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 = input("Enter Score: ") | |
try: | |
s=float(score) | |
except: | |
print('error') | |
quit() | |
if s>=0.9: | |
print('A') | |
elif s>=0.8: |