攝影或3C

Python random.randint(a , b)與tuple, set, issubset(), issuperset()

#Python random與tuple, set, issubset(), issuperset()

import random
lst=[]
for i in range(1,11):
randNum = random.randint(1,100)
lst.append(randNum)
print(lst)

tp=tuple(x for x in lst)
print(tp)

 

def operation(set11,set22):
print()
print(“set1 is a subset of set2:”\
,set11.issubset(set22))
print(“set1 is a superset of set2:”\
,set11.issuperset(set22))

def inputData(set11):
#set11={} #input時已經設定好空set
while True:
a = eval(input())
if a != -9999:
set11.add(a)
else:break
return set11

def main():
print(“Input set1 data: “)
set1=set()
inputData(set1)

print(“Input set2 data: “)
set2=set()
inputData(set2)

print(“set1:”,set1)
print(“set2:”,set2)
operation(set1,set2)

main()

 

儲蓄保險王

儲蓄險是板主最喜愛的儲蓄工具,最喜愛的投資理財工具則是ETF,最喜愛的省錢工具則是信用卡