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))