自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 Java设计模式——单例模式

Java设计模式——单例模式

2022-10-13 16:41:16 182 1

原创 java回形针数输出

尚硅谷练习:回形针数从键盘输入一个整数(1~20)则以该数字为矩阵的大小,把1,2,3…n*n 的数字按照顺时针螺旋的形式填入其中。例如: 输入数字2,则程序输出:1 24 3输入数字3,则程序输出:1 2 38 9 47 6 5输入数字4, 则程序输出:1 2 3 412 13 14 511 16 15 610 9 8 7方法一:import java.util.Scanner;public class PaperClip0 {

2021-04-14 17:18:24 610

原创 利用java输出星号金字塔

import java.util.Scanner;public class ForForTest1 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("请输入金字塔的层数:"); int tier = scanner.nextInt(); for (int i = 0;

2021-04-13 22:28:59 4162

原创 java杨辉三角形输出

public class ArrayExercise1 { /*杨辉三角11 1 1 2 11 3 3 11 4 6 4 11 5 10 10 5 11 6 15 20 15 6 11 7 21 35 35 21 7 11 8 28 56 70 56 28 8 11 9 36 84 126 126 84 36 9 1 */ public static void main(Str

2021-04-13 21:21:09 167

原创 利用python爬取《三国演义》全本

# -*- coding: utf-8 -*-# @ 2021/3/10 19:53# @ 三国演义(txt).py# @ DQMNBimport reimport osimport urllib.requestimport urllib.errorfrom time import sleepfrom tqdm import tqdmfindbiaoti = re.compile(r'<h2 class="grap--h2">(.*?)</h2>')find

2021-03-15 19:43:32 2188 1

原创 数据的去重与排序-Python

from random import randintls = []h = int(input("输入个数:"))for i in range(h): ls.append(randint(1, 1000))ls = list(set(ls))ls.sort()print(ls)

2020-11-05 14:19:52 193

原创 统计单一数字的个数-Python

txt = list(input("输入数字(用逗号分割):"))s1 = set(txt)for num in s1: txt.remove(num)s2 = set(txt)count = len(s1)-len(s2)print("单一数字的个数为:{}".format(count))

2020-11-04 14:22:50 292

原创 星号金字塔-Python

a = 2 * eval(input("输入金字塔层数:"))for i in range(1, a+1, 2): b = (a-i)//2 print(' '*b, '*'*i)每行有奇数个星号组成。

2020-11-03 11:40:00 3516

原创 字典键值互换-Python

a1 = {'a': 1, 'b': 2, 'c': 3, 'd': 4}a2 = {}for i in list(a1.items()): a2[i[1]] = i[0]print(a2)

2020-11-02 14:01:12 350

原创 汉诺塔-Python

def han(n, a, b, c): if n == 1: print("{}号盘子,从{}柱移动到{}柱。".format(1, a, b)) else: han(n-1, a, c, b) print("{}号盘子,从{}柱移动到{}柱。".format(n, a, b)) han(n-1, c, b, a)n = eval(input("输入盘子数:"))print("盘子从上到下依次编号,三个垂直柱分别为AB

2020-11-01 13:10:32 149

原创 小写字符分布-Python

a, b = {}, ''txt = input("输入:")for i in "!@#$%^&*(){:'}?/|\_,.<>;`~-=+": # 去除特殊符号 txt = txt.replace(i, '')for j in txt: # 筛选小写字母 if ord('a') <= ord(j) <= ord('z'): a[j] = a.get(j, 0)+1items = list(a.items())items.sort

2020-10-31 11:15:57 163

原创 十六进制降序输出-Python

# 调用函数import turtle # 海龟画图import time # 控制数字显示时间# 绘制数码管间隔def jiange(): turtle.penup() turtle.fd(10)# 绘制单段数码管def danduan(x): jiange() turtle.pendown() if x else turtle.penup() turtle.fd(80) jiange() turtle.right(90)

2020-10-28 11:03:52 278

原创 统计文本单词数目--Python

统计单词数目–Pythondef tihuan(): # 文本Python之禅 txt = "The Zen of Python, by Tim Peters\Beautiful is better than ugly.\Explicit is better than implicit.\Simple is better than complex.\Complex is better than complicated.\Flat is better than nested.\Spar

2020-10-28 10:41:51 288

空空如也

空空如也

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

TA关注的人

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