Notice
Recent Posts
Recent Comments
Link
«   2026/06   »
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
Archives
Today
Total
관리 메뉴

학습기록남기기

2022_07_04_Python_4일 본문

수업_정리

2022_07_04_Python_4일

backend_na 2022. 7. 4. 17:12
set

빈 set자료형 선언  : set()

a={'a','b','c'}
b={'z','x'}
a.add('d')
a.remove('b')
a.upadte(b)

연산
합집합 : |
교집합 : &
차집합 : -
배타적 차집합 : ^
부분 집합 : <=

함수

def ex_aa(a,b,c):
	print(a,b,c)

ex_aa('a','b','c')

n1,n2,n3=map(int,input('3개 입력 :').split())

re=list(map(int,input('입력 : ').split()))

def aa(begin,end,step=1):
print(aa(1,2))  ## OK
print(aa(1,2,3) ## OK

def calc_sum(end,begin=0,step=1): 
    sum=0
    for n in range(begin,end+1,step):
        sum+=n
    return sum

print(calc_sum(100))  ##OK
print(calc_sum(begin=10,step=5,end=1)  ##OK
print(calc_sum(20,step=3,begin=10))  ## OK 

def calc_total(*nums):
    #print(type(nums))  type->tuple
    total=0
    for n in nums:
        total+=n
    return total

print(calc_total(5,7,32,2,1,35,4,68,4354,65,1231,56,789615,340564036,2156164))

'수업_정리' 카테고리의 다른 글

2022_07_06_Python_7일  (0) 2022.07.06
2022_07_05_Python_5  (0) 2022.07.05
2022_07_01_Python_3일  (0) 2022.07.01
2022_06_30_Python_2일  (0) 2022.06.30
2022_06_29_Spring_19일  (0) 2022.06.29