Python
郭守军
爱学习,爱生活
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
python 计算1+2!+3!+.....+10!
python 计算1+2!+3!+…+10! sum,tmp =0,1 for i in range(1,11): tmp*=i sum+=tmp print("运算的结果是: {}".format(sum))原创 2021-10-24 11:25:55 · 13583 阅读 · 1 评论 -
python 绘制一个太阳花图形
python 绘制一个太阳花图形 python 绘制一个太阳花图形 from turtle import * color('red','yellow') begin_fill() while True: forward(200) left(170) if abs(pos())<1: break end_fill() done() 绘制的太阳花图形如下: ...原创 2021-10-20 17:07:38 · 679 阅读 · 0 评论 -
Python 五角星的绘制
Python 五角星的绘制 绘制一个红色的五角星 from turtle import * fillcolor("red") begin_fill() while True: forward(400) right(144) if abs(pos())<1: break end_fill()原创 2021-10-20 16:59:01 · 742 阅读 · 0 评论 -
Python 九九乘法表的输出
Python 九九乘法表的输出 工整打印输出常用的九九乘法表,格式不限 for i in range(1,10): for j in range(1,i+1): print("{}*{}={:2}".format(j,i,i*j),end='') print('')原创 2021-10-20 16:51:20 · 1072 阅读 · 0 评论 -
Python 日期和时间的输出
Python 日期和时间的输出 from datetime import datetime #引入datetime库 now = datetime.now() #获得当前的日期和时间的信息 print(now) now.strftime("%x") #输出其中的日期部分 now.strftime("%X") #输出其中的时间部分原创 2021-10-20 16:45:25 · 4786 阅读 · 0 评论 -
Python 同切圆的绘制
import turtle turtle.pensize(2)#设置画笔宽度为两像素 turtle.circle(10)#绘制半径为10像素的圆 turtle.circle(40)#绘制半径为40像素的圆 turtle.circle(80)#绘制半径为80像素的圆 turtle.circle(160)#绘制半径为160像素的圆 运行结果如下: ...原创 2021-10-20 16:32:57 · 4047 阅读 · 0 评论 -
Python 简单的人名对话
简单的人名对话 name=input ("请输入姓名:") print("{}同学,学好Python,前途无量!".format(name)) print("{}大侠,学好Python,大展拳脚!".format(name[0])) print("{}giegie,学好Python,人见人爱!".format(name[1:]))原创 2021-10-20 16:17:35 · 3475 阅读 · 0 评论 -
Python 圆面积的计算
Python 圆面积的计算 radius=25 //圆的半径是25 area=3.1415*radius*radius //输入计算公式 print(area) print("{:.2f}".format(area)) //只输出两位小数 最基础的程序相当于输出hello world!原创 2021-10-20 16:07:48 · 2322 阅读 · 0 评论
分享