diff --git a/day5/字典函数.py b/day5/字典函数.py new file mode 100644 index 0000000..1f7bbe1 --- /dev/null +++ b/day5/字典函数.py @@ -0,0 +1,9 @@ +#a={'key':'value',} +def YuanShen(UID)->int: + if UID > 300000000: + print('欢迎新人') + else: + print('恭迎学长') + return UID +UID=int(input('UID:')) +YuanShen(UID) \ No newline at end of file diff --git a/day6/新.py b/day6/新.py new file mode 100644 index 0000000..d18f72f --- /dev/null +++ b/day6/新.py @@ -0,0 +1,9 @@ +#必备参数 +#关键字传参 +#默认参数 +#不定长参数(*name) +##匿名函数sum = lambda x,y: x+y sum(x,y) +##局部,全局变量 +### +import rich +rich.print("[blue underline]Looks like a link") diff --git a/day7/彩票模拟.py b/day7/彩票模拟.py new file mode 100644 index 0000000..00aaca3 --- /dev/null +++ b/day7/彩票模拟.py @@ -0,0 +1,35 @@ +import random + +randomlist = [] + + +def add(): + randomlist.append(random.randint(1000, 9999)) + return randomlist + + +number = int(input("初始量:")) +if number <= 0: + print("初始量须>=1") + number = int(input("初始量:")) +for i in range(1, number + 1): + if i <= number: + add() +while True: + randomlist.append(int(input("加入4位竞猜号码"))) + a = int(input("是否继续加入(1是2否)")) + if a == 1: + continue + else: + break +randomlist.sort() +print(randomlist) +choice = int(input("请确认彩票号码")) +if choice not in randomlist: + print("不在范围内") + choice = int(input("请确认彩票号码")) +correct = random.choice(randomlist) +if choice == correct: + print("中") +else: + print("手慢无")