您的位置:首页 > 数据库 > Redis

高级Redis应用进阶课 一站式Redis解决方案

2021-02-02 02:23 956 查看

download: 高级Redis应用进阶课 一站式Redis解决方案 【完结】

本课程以一个实战项目为主线,整合Redis各种问题场景,不断改造项目,以问带学。学完本课后,面对Redis相关问题,你将能够快速进行排查与修复,无论实际工作还是跳槽面试你都将游刃有余。

适合人群
对Redis有兴趣,但不懂如何和项目深度结合的后端工程师
了解Redis日常操作,但不懂得Redis底层原理的后端工程师
遇到Redis故障完全没有思路,不知如何解决的后端工程师
技术储备要求
后端web开发基础

1 a=int(input('please enter 1st num:'))
2 b=int(input('please enter 2nd num:'))
3 s=a*b
4
5 while a!=b:
6 if a>b:
7 a-=b
8 elif a<b:
9 b-=a
10 else:
11 print(a,'is the maximum common divisor')
12 print(s//a,'is the least common multiple')
13
14 #运行结果
15 please enter 1st num:40
16 please enter 2nd num:60
17 20 is the maximum common divisor
18 120 is the least common multiple
复制代码
5。判断是否为闰年 (辗转相除法)
复制代码
1 # 判断是否为闰年
2 while True:
3 try:
4 num=eval(input("请输入一个年份:"))
5 except:
6 print('输入错误年份')
7 continue
8 if (num %4==0 and num%100 !=0) or num %400==0:
9 print(num,"是闰年")
10 else:
11 print(num,"不是闰年")
复制代码

复制代码
import calendar

year = int(input("请输入年份:"))
check_year=calendar.isleap(year)
if check_year == True:
print ("闰年")
else:
print ("平年")
复制代码
6。Python统计字符串中数字,字母,汉字的个数
复制代码
1 import re
2 str_test='abcdefgHABC123456中华民族'
3
4 #把正则表达式编译成对象,如果经常使用该对象,此种方式可提高一定效率
5 num_regex = re.compile(r'[0-9]')
6 zimu_regex = re.compile(r'[a-zA-z]')
7 hanzi_regex = re.compile(r'[\u4E00-\u9FA5]')
8
9 print('输入字符串:',str_test)
10 #findall获取字符串中所有匹配的字符
11 num_list = num_regex.findall(str_test)
12 print('包含的数字:',num_list)
13 zimu_list = zimu_regex.findall(str_test)
14 print('包含的字母:',zimu_list)
15 hanzi_list = hanzi_regex.findall(str_test)
16 print('包含的汉字:',hanzi_list)
复制代码
#羊车门问题

复制代码
1 import random as r
2
3 #总次数
4 total=1000000 #1000,1W,10W,100W
5 #换与不换的获胜次数
6 win1=0
7 win2=0
8
9 for i in range(total):
10 #模拟选择过程
11 man=r.randint(1,3)
12 car=r.randint(1,3)
13 #结果:一开始为车门,不换+1.
14 # 否则则一开始为羊门,换+1.
15 if man==car:
16 win1+=1
17 else:
18 win2+=1
19
20 print("在{}次实验中:".format(total))
21 print("若不更改门,获胜概率为{:.3}%.".format((win1/total)100))
22 print("若更改门,获胜概率为{:.3}%.".format((win2/total)100))
复制代码
复制代码
1 import random
2 x=random.randint(5000,10000)
3 print(x)
4 change=0
5 nochange=0
6 for i in range(1,x+1):
7 a=random.randrange(1,4)
8 b=random.randrange(1,4)
9 if a==b:
10 nochange=nochange+1
11 else:
12 change=change+1
13 print("不更改选择得到汽车的概率为{:.2f}".format(nochange/x))
14
15 print("更改选择得到汽车的概率为{:.2f}".format(change/x))
复制代码

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐