- 博客(7)
- 收藏
- 关注
原创 用马青公式计算圆周率,Python语言
马青公式:简单实现#定义计算的位数num = 10#多计算10位,以防出错num1 = num + 10#定义计算小数位数b = 10**num1#前面括号的第一项x1 = 4*b//5#后面括号的第一项x2 = 1*b//(-239)he = x1 + x2#定义循环截止数num = 2*numfor i in range(3,num,2): x1 = x1//-25 x2 = x2//(-239**2) x = (x1+ x2)//i.
2021-11-09 14:51:12
2545
原创 python统计大小写字母个数
def count_str(str_in): up_count = 0 low_count = 0 for i in str_in:#for循环遍历 if i.isupper():#语句判断 up_count += 1 elif i.islower: low_count += 1 else: continue return up_count,low_.
2021-11-03 13:59:41
15350
2
原创 python应用存储朋友生日小程序
def save_brithday(name,year,month,day): brithday = year + "-" + month + "-" + day full_brithday = {name:brithday} return full_brithdayb = []while 1: print("请按人任意键输入信息,按q则推出程序") a = input() if a == "q": break else: .
2021-11-03 11:54:20
212
原创 用Python做一个小程序:猜数字小游戏
import randomnum = random.randrange(1,51)cai = int(input("请猜数字:(1-50之间)"))while 1:#一直循环 if cai == num: print("恭喜猜对了!") break elif cai < num: print("你猜的小了") cai = int(input("请重新猜数字:")) continue els.
2021-10-30 15:51:26
2842
原创 用Python实现词频统计
#词频统计a = "And how will this be accomplished? For I have neither the knowledge nor the experience to achieve the greatness and already I have stumbled in ignorance and fallen into pools of self-pity. The answer is simple. I will commence my journey unenc.
2021-10-30 10:57:38
136
原创 用Python实现简单登录注册
ID = {"杨幂":'yang','王一博':'wang','阿里巴巴':'ali'}name = input("请输入你的账户:")mima = input("请输入密码:")for i in range(10): if i < 5: if mima == ID.get(name): print("登录成功") break else: if name not in ID.key...
2021-10-29 17:05:32
447
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人