随笔分类 -  Python

摘要:#转换函数使用a,b=input().split(",")b=int(b)print(int(a,b)) 阅读全文
posted @ 2025-01-02 20:40 Grit_Doyle 阅读(2) 评论(0) 推荐(0) 编辑
摘要:#特殊a串数列求和a,n=input().split()n=int(n)s=0for i in range(n): s+=eval(a*(i+1))print("s =",s) 阅读全文
posted @ 2025-01-02 20:40 Grit_Doyle 阅读(8) 评论(0) 推荐(0) 编辑
摘要:#输出华氏-摄氏温度转换表a,b=input().split()a,b=eval(a),eval(b)if(a>b): print("Invalid.")else: print("fahr celsius") i = a while i <= b: print("{:d}{:>6.1f}".form 阅读全文
posted @ 2025-01-02 20:39 Grit_Doyle 阅读(8) 评论(0) 推荐(0) 编辑
摘要:s="Python语言简单易学" print(s.encode("utf-8")) 阅读全文
posted @ 2025-01-02 20:39 Grit_Doyle 阅读(5) 评论(0) 推荐(0) 编辑
摘要:#求奇数分之一序列前N项和N=int(input())S=0t=1for i in range(N): S+=1/(t) t+=2print("sum = {:.6f}".format(S)) 阅读全文
posted @ 2025-01-02 20:39 Grit_Doyle 阅读(2) 评论(0) 推荐(0) 编辑
摘要:#求交错序列前N项和N=int(input())S=0t=1for i in range(N): if i%2==0: S=S+(i+1)/(t) t=(t+2) else: S=S-(i+1)/(t) t=(t+2)print("{:.3f}".format(S)) 阅读全文
posted @ 2025-01-02 20:38 Grit_Doyle 阅读(2) 评论(0) 推荐(0) 编辑
摘要:#阶梯电价e=float(input())cost=0if e<0: print("Invalid Value!")elif e<=50: cost=e*0.53 print("cost = {0:.2f}".format(cost))else: cost=50*0.53+(e-50)*0.58 p 阅读全文
posted @ 2025-01-02 20:38 Grit_Doyle 阅读(3) 评论(0) 推荐(0) 编辑
摘要:#计算分段函数[1]x=float(input())if x==0: y=0else: y=1/xprint("f({0:.1f}) = {1:.1f}".format(x,y)) 阅读全文
posted @ 2025-01-02 20:37 Grit_Doyle 阅读(2) 评论(0) 推荐(0) 编辑
摘要:#计算 11+12+13+...+mm=int(input())sum=0for i in range(11,m+1): sum+=iprint("sum =",sum) 阅读全文
posted @ 2025-01-02 20:37 Grit_Doyle 阅读(9) 评论(0) 推荐(0) 编辑
摘要:#从键盘输入三个数到a,b,c中,按公式值输出a,b,c=input().split()a=int(a)b=int(b)c=int(c)print(b*b-4*a*c) 阅读全文
posted @ 2025-01-02 20:37 Grit_Doyle 阅读(14) 评论(0) 推荐(0) 编辑
摘要:A=int(input())B=int(input())print(A+B) 阅读全文
posted @ 2025-01-02 20:36 Grit_Doyle 阅读(6) 评论(0) 推荐(0) 编辑
摘要:#产生每位数字相同的n位数A,B=input().split(",")A=A.strip()B=int(B.strip())print(int(A*B)) 阅读全文
posted @ 2025-01-02 20:36 Grit_Doyle 阅读(3) 评论(0) 推荐(0) 编辑
摘要:#比较大小print(*sorted(map(int,input().split())),sep="->") 阅读全文
posted @ 2025-01-02 20:35 Grit_Doyle 阅读(8) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2025-01-02 18:28 Grit_Doyle 阅读(5) 评论(0) 推荐(0) 编辑
摘要:1.双击python安装包 2.自定义安装配置 3.选择安装路径 4.检测安装 输入python 阅读全文
posted @ 2022-06-28 21:32 Grit_Doyle 阅读(38) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示