自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(28)
  • 收藏
  • 关注

原创 用Python画一个小猪佩奇

from turtle import *def nose(x, y): pu() goto(x, y) pd() seth(-30) begin_fill() a = 0.4 for i in range(120): if 0 <= i < 30 or 60 <= i < 90: a = a + 0.08 lt(3) fd(a) .

2021-08-16 17:56:38 225

原创 用Python画一个时钟

import turtlefrom datetime import *# 抬起画笔,向前运动一段距离放下def Skip(step): turtle.penup() turtle.forward(step) turtle.pendown()def mkHand(name, length): # 注册Turtle形状,建立表针Turtle turtle.reset() Skip(-length * 0.1) # 开始记录多边形的顶点。当.

2021-08-16 17:52:05 1773

原创 Python中查看输入的日期是一年中的第几天

year = int(input('请输入年份:'))month = int(input('请输入月数:'))day = int(input('请输入天数:'))months = (0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334)if 0 < month <= 12: sum = months[month - 1]else: print('data error')sum += dayleap = 0i.

2021-08-16 17:47:34 905

原创 Python中,数字1-5可以组成的互不相同且无重复数字的三位数。

for i in range(1, 6): for j in range(1, 5): for k in range(1, 5): if (i != k) and (i != j) and (j != k): print(i, j, k)效果:1 2 31 2 41 3 21 3 41 4 21 4 32 1 32 1 42 3 12 3 42 4 12 4 33 1 23 1 43 2 1.

2021-08-16 17:41:41 2233

原创 Python中的BMI指数

height = eval(input("请输入身高(单位:m):")) # 保存身高的变量,单位:mweight = eval(input("请输入体重(单位:kg):")) # 保存体重的变量,单位:kgbmi = weight / pow(height, 2) # 用于计算BMI指数,公式:BMI=体重/(身高*身高)print('您的BMI指数为:{:.2f}'.format(bmi)) # 输出BMI指数# 判断身材是否合理if bmi < 18.5: pr.

2021-08-16 17:37:23 3039

原创 Python中的九九乘法表

for i in range(1,10): for j in range(1,i+1): result=j*i print(j,"*",i,"=",result,'','\t',end=" ") print()效果:

2021-08-16 17:31:43 124

原创 Python水仙花数、四叶玫瑰数、五角星数的可选操作

import time# 格式化成2021-08-16 17:20:15形式nowTime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())print(nowTime)def ThreeNum(): three = [] count = 0 for i in range(100, 1000): n1 = i // 100 # 取整除 百位 n2 = (i -.

2021-08-16 17:25:17 2127

原创 Python中的水仙花数运算

for i in range(100,1000): a = i//100 b = (i-a*100)//10 c = (i-a*100-b*10) if i == pow(a,3)+pow(b,3)+pow(c,3): print('水仙花数为:',i)效果:水仙花数为: 153水仙花数为: 370水仙花数为: 371水仙花数为: 407...

2021-08-15 23:23:57 253

原创 Python中的质数运算(101到200)

print('质数为:')for i in range(101, 201): for j in range(2, i): if i % j == 0: break else: print(i)效果:质数为:101103107109113127131137139149151157163167173179181191193197199

2021-08-15 23:21:57 1973

原创 用Python语言实现2000年到2021年中平年和闰年的识别,且存于字典中。

year = [x for x in (range(2000, 2022))]d1 = {}for i in year: if i % 400 == 0 or (i % 4 == 0 and i % 100 != 0): d1[i] = '闰年' else: d1[i] = '平年'print(d1)效果:{2000: '闰年', 2001: '平年', 2002: '平年', 2003: '平年', 2004: '闰年', 2005: '平.

2021-08-15 23:15:06 1286

原创 Python中编写斐波那契数列的3种方法

1. 常规方法a = 0b = 1x = 1while x <= 10: if x == 1: print(0) elif x == 2: print(1) else: c = a + b print(c) a = b b = c x += 1效果:01123581321342. 使用函数的表达方法def fib1(m):

2021-08-15 23:05:03 3761

原创 在HTML中使用Javascript和CSS制作九九乘法口诀表

<html> <head> <title>99乘法表</title> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <style type="text/css"> table{ width:800px; border-collapse:separate; } table td{ bor.

2021-07-21 17:52:29 2103 1

原创 MySQL查询101课程比102课程成绩高的所有学生的学号

首先,建一个表scCREATE TABLE sc(sno INT,cno INT,score INT, FOREIGN KEY(sno)REFERENCES student(sno),FOREIGN KEY(cno)REFERENCES course(cno));再给表sc添加数据INSERT INTO sc(sno,cno,score) VALUES(1,101,87);INSERT INTO sc(sno,cno,score) VALUES(2,101,66);INSER

2021-07-19 12:07:41 1558

原创 Java练习题11:用for循环打印出九九乘法表

for(int q=1;q<=9;q++) { for(int w=1;w<=q;w++) { System.out.print(w+"*"+q+"="+q*w+" "); } System.out.println();}

2021-07-07 13:49:06 148

原创 Java练习题10:选1打印5个*,选其他打印5个@

int m=0; if (m==1) { for(m=1;m<=5;m++) { System.out.print("*"); } System.out.print(" "); } else if(m!=1) { for(m=1;m<=5;m++) { System.out.print("@"); } } System.out.println(" "); int m=0...

2021-07-06 11:49:21 185

原创 Java练习题9:手里的钱判断交通工具,大于20打车,大于5地铁,大于2公交,否则走路

int Money=100; if(Money>20) { System.out.println("Taxi"); } else if(Money>5) { System.out.println("Subway"); } else if(Money>2) { System.out.println("Bus"); } else if(Money<=2) { System.out.prin...

2021-07-06 11:46:44 93

原创 Java练习题8:输出1000以内能同时被3和7整除的正整数

int x=1; System.out.println("1000以内可以同时被3和7整除的正整数: "); for(int i3=1;i3<=1000;i3++) { if(i3%3!=0||i3%7!=0) continue; System.out.print(i3+" "); if(x++%15==0) System.out.println(""); } System.out.println(" ");1000以内可...

2021-07-06 11:44:46 4022

原创 Java练习题7:3种循环方法(for\while\do while)实现1+2+.......+100,求和

//for语句 int sum=0; for(int x=1; x<=100; x++) { sum+=x; System.out.println(sum); }//while语句 int sum1=0; int x1=1; while(x1<=100) { sum1=sum1+x1; System.out.println(sum1); x1++; }//do while语句 int x.

2021-07-06 11:43:02 1115

原创 Java练习题6: a=20,b=10,用IF语句求最大值

int d1=20; int e1=10; if(d1>e1) { System.out.println("最大值是"+d1); }最大值是20

2021-07-06 11:38:41 174

原创 Java练习题5:a=20,b=10,用三元运算符求最大值

int d=20; int e=10; System.out.println(d>e?"最大值是"+d:"最大值是"+e);最大值是20

2021-07-06 11:37:19 226

原创 Java练习题4:int i = 1; i+=++i; 心算i的值是?

i=(i)+(++i)i=1+2=3

2021-07-06 11:35:49 207

原创 Java练习题3:a=36,b=23,然后使用(> 大于) (>= 大于或等于 )(< 小于) (<= 小于或等于)(== 是否相等)(!= 是否不等)

int a1=36; int b1=23; System.out.println(a1>b1); System.out.println(a1>=b1); System.out.println(a1<b1); System.out.println(a1<=b1); System.out.println(a1==b1); System.out.println(a1!=b1);

2021-07-06 11:34:20 94

原创 Java练习题2:int i = 1; int j = ++i + i++ + ++i + ++i + i++; 问 j的结果是多少?

int i=1;int j=++i + i++ + ++i + ++i + i++;//j=2+2+4+5+5=18System.out.println(j);

2021-07-06 11:31:40 1517

原创 Java练习题1. a=36,b=83计算这两个数字的和

public static void main(String [] args) { int a=36; int b=83; System.out.println(a+b);

2021-07-06 11:29:37 63

原创 Java中用if语句表示月份的天数

//月份的if语法 int Month=12; if(Month==1||Month==3||Month==5||Month==7||Month==8||Month==10||Month==12) { System.out.println("31天"); } else if(Month==2){ System.out.println("28天"); } else if(Month==4||Month==6||Month==9||Month==11){ System.

2021-07-05 16:01:01 1436

原创 Java中Switch语句对月份的天数判断

2021-07-05 15:57:52 579

原创 Java中Switch语句对星期的判断

public class Multiple { public static void main(String [] args) { //星期的判断 int W=5; switch(W) { case 1: System.out.println("Monday"); break; case 2: System.out.println(...

2021-07-05 15:54:46 1206

原创 Java中if语句:判断某年是否是闰年,闰年条件:能整除4且不能整除100,或者可以被400整除。

2021-07-05 15:03:33 1751

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除