06 2023 档案

摘要:def di_gui(n): if n==1: return 1 return n * di_gui(n-1) print(di_gui(3)) 1*2*3=6 阅读全文
posted @ 2023-06-30 18:15 胖豆芽 阅读(4) 评论(0) 推荐(0) 编辑
摘要:# 定义一个函数 def say(name): print(f"hello,{name}!") # 定义第二个函数 def sum(*a): sum = 0 for i in a: i-= 1 sum+= a[i] print(sum) return sum # 调用第一个函数 say("fqs") 阅读全文
posted @ 2023-06-30 16:15 胖豆芽 阅读(7) 评论(0) 推荐(0) 编辑
摘要:# 多个参数传入函数 # 第一种 位置参数 def func(a, b, c): print(a, b, c) func(1, 2, 3) # 1 2 3 # 第二种 关键字参数 def func2(a, b, c): print(a, b, c) func2(c = 'cc',a ='aa', b 阅读全文
posted @ 2023-06-30 15:01 胖豆芽 阅读(7) 评论(0) 推荐(0) 编辑
摘要:# 给你一个整数数组 nums 。# 如果任一值在数组中出现 至少两次 ,返回 true ;# 如果数组中每个元素互不相同,返回 false 。def remove_dup(nums): unique_nums = list(set(nums)) return unique_numsdef is_x 阅读全文
posted @ 2023-06-30 14:05 胖豆芽 阅读(4) 评论(0) 推荐(0) 编辑
摘要:# 回文数 123 不是;121 是 num = 1221 # 反转后 num_fan = str(num)[::-1] #判断 if num==int(num_fan): print("True") else: print("False") 阅读全文
posted @ 2023-06-30 08:57 胖豆芽 阅读(2) 评论(0) 推荐(0) 编辑
摘要:# 回文数 121 是; 123 不是 #定义一个函数 判断是否是回文数 def get_Hui(num): #将整数num转字符串 str_num = str(num) str_num_change = str_num[::-1] num2 = int(str_num_change) #判断整数n 阅读全文
posted @ 2023-06-29 21:13 胖豆芽 阅读(10) 评论(0) 推荐(0) 编辑
摘要:https://leetcode.cn/problemset/all/ 第7题 整数取反在 Python 中,切片(slicing)是一种从序列(如字符串、列表、元组等)中获取子序列的方法,不能对整数做切片,需要先转序列为整数。切片操作使用方括号 `[]` 来实现,可以包含开始索引、结束索引和步长。 阅读全文
posted @ 2023-06-29 20:50 胖豆芽 阅读(30) 评论(0) 推荐(0) 编辑
摘要:调用函数# 整数转16进制 没有.hex 而是直接 hex(参数) n1 = 255 n2 = 1000 print(hex(n1)) print(hex(n2)) 定义函数# 定义函数 获得正数 def my_abs(x): if x>=0: return x; else: return -x; 阅读全文
posted @ 2023-06-29 20:29 胖豆芽 阅读(7) 评论(0) 推荐(0) 编辑
摘要:# 字典 zd={'name': 'fqs', 'age': 36, 'class':1, 'w': 'ww'} print(zd['name']) # 更改字典内的值 zd['name']='douDou' print(zd) # 判断字典内是否存在某个值 # 第一种 写值 print('fqs' 阅读全文
posted @ 2023-06-29 19:14 胖豆芽 阅读(1) 评论(0) 推荐(0) 编辑
摘要:# 判断 print("请输入你的年龄") age = int(input()) if age >=18: print(f'你的年龄是:{age},成年了') else: print("小于18未成年") # 判断print("请输入你的年龄")age = int(input())if age >= 阅读全文
posted @ 2023-06-29 17:51 胖豆芽 阅读(8) 评论(0) 推荐(0) 编辑
摘要:# list列表 classmate = ["lily", "jjj", "hhh"] # 打印列表的长度 print(len(classmate)) # 打印下标为0的 print(classmate[0]) # 打印下标为-1的元素 倒数第一个元素 print(classmate[-1]) # 阅读全文
posted @ 2023-06-29 16:52 胖豆芽 阅读(6) 评论(0) 推荐(0) 编辑
摘要:print('I\'m ok') 第二种 print(r"I'm ok") 打印 多行 print('''第一行 第二行 第三行''') D:\pythonProject\venv\Scripts\python.exe D:/pythonProject/main.py第一行第二行第三行 运算符 # 阅读全文
posted @ 2023-06-29 15:13 胖豆芽 阅读(12) 评论(0) 推荐(0) 编辑
摘要:public class Str3 { public static void main(String[] args) { //将数组转【字,符,串】 //数组 int[]arrNum={1,2,3,4,5}; String ss=getStr(arrNum); System.out.println( 阅读全文
posted @ 2023-06-21 18:08 胖豆芽 阅读(4) 评论(0) 推荐(0) 编辑
摘要:public class MaoPao { public static void main(String[] args) { //冒泡排序 最大的放在最后面 //定义一个数组 int[]arr={11,99,0,3,5,6,5,3,5,8,1}; //前一个数和后一个数比较如果 后一个数大 放在后面 阅读全文
posted @ 2023-06-21 17:12 胖豆芽 阅读(3) 评论(0) 推荐(0) 编辑
摘要:import java.util.Random; public class NoR { public static void main(String[] args) { //随机数 Random r=new Random(); //目标随机数组的范围 int len=9; //目标 存放随机数的数组 阅读全文
posted @ 2023-06-21 16:34 胖豆芽 阅读(81) 评论(0) 推荐(0) 编辑
摘要:public class Str2 { public static void main(String[] args) { //定义一个数字数组 int []arr={1,2,3,4}; //目标输出字符串 String result=getString(arr); System.out.printl 阅读全文
posted @ 2023-06-20 21:49 胖豆芽 阅读(12) 评论(0) 推荐(0) 编辑
摘要:import java.util.Random; public class No2 { public static void main(String[] args) { //定义一个随机数 Random r=new Random(); //定义范围 int len=9; //一个随机数先放到数组第一 阅读全文
posted @ 2023-06-20 21:09 胖豆芽 阅读(10) 评论(0) 推荐(0) 编辑
摘要:优化后 package com.fqs.demo001; import java.util.Scanner; public class Compare { public static void main(String[] args) { //键盘录入一个字符串,统计该字符串大写字母字符,小写字母字符 阅读全文
posted @ 2023-06-16 18:20 胖豆芽 阅读(24) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.demo001; import java.util.Scanner; public class Compare { public static void main(String[] args) { //键盘录入一个字符,使用程序实现 在控制台遍历该字符串 //比如键盘 阅读全文
posted @ 2023-06-16 16:17 胖豆芽 阅读(5) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.demo001; import java.util.Scanner; public class Compare { public static void main(String[] args) { String name="abc"; String secret="a 阅读全文
posted @ 2023-06-16 15:21 胖豆芽 阅读(57) 评论(0) 推荐(0) 编辑
摘要:原因是new 是开辟了一个新的空间 1 package com.fqs.demo001; 2 3 public class Compare { 4 public static void main(String[] args) { 5 String s1=new String("a,b,c"); 6 阅读全文
posted @ 2023-06-16 14:40 胖豆芽 阅读(14) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.demo005; public class S { public static void main(String[] args) { //1 基本的字符串 String s="abc"; System.out.println(s); //2. new 一个构造方法 S 阅读全文
posted @ 2023-06-15 21:19 胖豆芽 阅读(6) 评论(0) 推荐(0) 编辑
摘要:对象 package com.fqs.demo003; import java.util.Scanner; public class Student { //学生的属性 private int id; private String name; private int age; public Stud 阅读全文
posted @ 2023-06-15 16:32 胖豆芽 阅读(34) 评论(0) 推荐(0) 编辑
摘要:对象 package com.fqs.demo002; public class Gril { //属性 private String name; private int age; private char sex; private String love; public Gril() { } pu 阅读全文
posted @ 2023-06-15 15:09 胖豆芽 阅读(12) 评论(0) 推荐(0) 编辑
摘要:对象 package com.fqs.Car; public class Car { //汽车的三个属性 private String brand; private double price; private String color; //javabean 格式 public Car() { } 阅读全文
posted @ 2023-06-14 18:54 胖豆芽 阅读(7) 评论(0) 推荐(0) 编辑
摘要:对象 package com.fqs.goods; public class Goods { private int id; private String name; private double price; private int geShu; public Goods() { } public 阅读全文
posted @ 2023-06-14 17:56 胖豆芽 阅读(41) 评论(0) 推荐(0) 编辑
摘要:对象-设计图 package com.fqs.combat; import java.util.Random; public class Role { private String name; private int blood; public Role() { } public Role(Stri 阅读全文
posted @ 2023-06-14 14:52 胖豆芽 阅读(62) 评论(0) 推荐(0) 编辑
摘要:对象 package com.fqs.GeDou; public class GeDou { //属性 private String name; private int xue; private int shangHai; public GeDou() { } public GeDou(String 阅读全文
posted @ 2023-06-13 18:24 胖豆芽 阅读(14) 评论(0) 推荐(0) 编辑
摘要:对象 package com.fqs.demo061302; public class Girl { //属性 //成员变量 private String name; private int age; /*public void setAge(int age) {//【局部变量 】 名称可以和上面的 阅读全文
posted @ 2023-06-13 15:38 胖豆芽 阅读(63) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.demo061302; public class Girl { //属性 //成员变量 String name; private int age; public void setAge(int age) {//【局部变量 】 名称可以和上面的【成员变量】一样 //赋值 阅读全文
posted @ 2023-06-13 15:11 胖豆芽 阅读(4) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.demo061301; import com.sun.scenario.effect.impl.prism.ps.PPStoPSWDisplacementMapPeer; import java.util.Random; public class ArrNo { pu 阅读全文
posted @ 2023-06-13 14:33 胖豆芽 阅读(1) 评论(0) 推荐(0) 编辑
摘要:类 封装 package com.fqs.demo061201; public class Girl { //属性 String name; private int age; //set赋值 public void setAge(int a){ if (age>18&& age<50){ age=a 阅读全文
posted @ 2023-06-12 20:57 胖豆芽 阅读(2) 评论(0) 推荐(0) 编辑
摘要:定义一个类Phone 手机的设计图 package com.fqs.demo0612; public class Phone { //定义一个类 手机 //属性 String brand; double price; //方法 public void call() { System.out.prin 阅读全文
posted @ 2023-06-12 19:52 胖豆芽 阅读(1) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test; import java.util.Random; public class hello { public static void main(String[] args) { //定义数组 int[][]arr3={ {1,2,3}, {4,5,6,7,8} 阅读全文
posted @ 2023-06-12 16:16 胖豆芽 阅读(10) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test; import java.util.Random; public class hello { public static void main(String[] args) { int []jang={11,22,33,44,55}; int weishu=5 阅读全文
posted @ 2023-06-12 14:24 胖豆芽 阅读(1) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test; import java.util.Random; public class hello { public static void main(String[] args) { int weishu=6; int []arr1=getNo(weishu); f 阅读全文
posted @ 2023-06-12 14:10 胖豆芽 阅读(4) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test; import java.util.Random; public class hello { public static void main(String[] args) { //获取 个不相等的随机数 int weishu=6; System.out.pr 阅读全文
posted @ 2023-06-12 13:58 胖豆芽 阅读(15) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test; import java.util.Random; public class hello { public static void main(String[] args) { //获取 个不相等的随机数 int weishu=6; System.out.pr 阅读全文
posted @ 2023-06-12 12:27 胖豆芽 阅读(8) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test; import java.util.Random; import java.util.Scanner; public class hello { public static void main(String[] args) { //获取三个不相等的随机数 i 阅读全文
posted @ 2023-06-09 20:47 胖豆芽 阅读(3) 评论(0) 推荐(0) 编辑
摘要:优化后 获得一个加密后值 package com.fqs.test; import java.util.Scanner; public class hello { public static void main(String[] args) { //加密传输 1983 //每位上加5 (1+5=6) 阅读全文
posted @ 2023-06-09 14:05 胖豆芽 阅读(13) 评论(0) 推荐(0) 编辑
摘要:优化后的 package com.fqs.test; import java.util.Random; import java.util.Scanner; public class hello { public static void main(String[] args) { //评委打分 评委个 阅读全文
posted @ 2023-06-08 21:08 胖豆芽 阅读(56) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test; import java.util.Random; public class hello { public static void main(String[] args) { //定义方法 实现随机产生一个5位的验证码 //验证码格式 长度5 // 前四位是 阅读全文
posted @ 2023-06-08 20:11 胖豆芽 阅读(11) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test; public class hello { public static void main(String[] args) { //卖飞机票 //机票的价格按照第一 淡11月到4月、旺季5月到10月; // 第二 头等舱 旺季 9折、经济舱旺季 8.5折收费 阅读全文
posted @ 2023-06-08 14:33 胖豆芽 阅读(16) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test; public class hello { public static void main(String[] args) { //需求:设计一个方法用于数组遍历 每次可以写100个数组,将数组打印出来; 要求遍历的结果是在一行上的。例如:[11,22,33, 阅读全文
posted @ 2023-06-08 11:22 胖豆芽 阅读(7) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test;public class hello { public static void main(String[] args) { //需求:求商场每个季度的营业额 获得整年的营业额 //求每个季度的营业额 int sum1=getSum(1,2,3,4); int 阅读全文
posted @ 2023-06-07 13:25 胖豆芽 阅读(16) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test; import java.util.Arrays; import java.util.Random; public class hello { public static void main(String[] args) { //调用方法 playGame( 阅读全文
posted @ 2023-06-07 11:57 胖豆芽 阅读(8) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test; import java.util.Arrays; public class hello { public static void main(String[] args) { //交换数组头尾交换 //交换前 12345 //交换后 54321 int [] 阅读全文
posted @ 2023-06-06 20:36 胖豆芽 阅读(10) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test; import java.util.Arrays; public class hello { public static void main(String[] args) { //动态初始化 数组 int []arr=new int[3]; for (int 阅读全文
posted @ 2023-06-06 19:26 胖豆芽 阅读(15) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test; public class hello { public static void main(String[] args) { //定义一个数组,存储12345 求和 int []arr={1,2,3,4,5}; int sum=0; for(int i=0; 阅读全文
posted @ 2023-06-06 18:59 胖豆芽 阅读(23) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test; import java.util.Arrays; import java.util.Random; import java.util.Scanner; public class hello { public static void main(String[ 阅读全文
posted @ 2023-06-06 18:41 胖豆芽 阅读(1) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test;import java.util.Random;import java.util.Scanner;public class hello { public static void main(String[] args) { //需求 程序自动生成一个1到100 阅读全文
posted @ 2023-06-06 18:04 胖豆芽 阅读(26) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test; import java.util.Random; import java.util.Scanner; public class hello { public static void main(String[] args) { //需求 程序自动生成一个1到 阅读全文
posted @ 2023-06-06 17:07 胖豆芽 阅读(12) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test; import java.util.Scanner; public class hello { public static void main(String[] args) { //循环中 逢7过 Scanner sc=new Scanner(System. 阅读全文
posted @ 2023-06-06 13:38 胖豆芽 阅读(6) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test; import java.util.Scanner; public class hello { public static void main(String[] args) { //循环中 跳过某个 for(int i=1;i<6;i++){ if(i==3 阅读全文
posted @ 2023-06-06 12:46 胖豆芽 阅读(32) 评论(0) 推荐(0) 编辑
摘要:1.快速生成main输入psvm 2快速生成System.out.print使用sout 3.运行 shift f10 4.for循环 for(int i=0;i<arr.length;i++){ } fori 5先选中 再shift+f6 全局改名 6.先写数组名okarr +.+fori 回车 阅读全文
posted @ 2023-06-06 12:35 胖豆芽 阅读(15) 评论(0) 推荐(0) 编辑
摘要:for循环 package com.fqs.test; import java.util.Scanner; public class hello { public static void main(String[] args) { //无限循环 for(;;){ System.out.print(" 阅读全文
posted @ 2023-06-06 12:29 胖豆芽 阅读(19) 评论(0) 推荐(0) 编辑
摘要:————————————————版权声明:本文为CSDN博主「biyusr」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。原文链接:https://blog.csdn.net/biyusr/article/details/125599865 1、对查询进行优化,应 阅读全文
posted @ 2023-06-05 20:27 胖豆芽 阅读(7) 评论(0) 推荐(0) 编辑
摘要:1.\r 叫回车 Carriage Return 2.\n 叫新行 New Line 但是都会造成换行, 阅读全文
posted @ 2023-06-05 14:45 胖豆芽 阅读(96) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test; import java.util.Scanner; import static jdk.nashorn.internal.objects.ArrayBufferView.length; public class hello { public static 阅读全文
posted @ 2023-06-02 21:04 胖豆芽 阅读(12) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test; import java.util.Scanner; public class hello { public static void main(String[] args) { //循环打印1到5 int i=0; while(i<5){ i++; Syst 阅读全文
posted @ 2023-06-02 17:48 胖豆芽 阅读(64) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test; import java.util.Scanner; public class hello { public static void main(String[] args) { //求1到5的和 int sum=0; for(int i=0;i<6;i++) 阅读全文
posted @ 2023-06-02 17:29 胖豆芽 阅读(103) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test; import java.util.Scanner; public class hello { public static void main(String[] args) { Scanner sc=new Scanner(System.in); Syste 阅读全文
posted @ 2023-06-01 20:38 胖豆芽 阅读(15) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test; import java.util.Scanner; public class hello { public static void main(String[] args) { Scanner sc=new Scanner(System.in); Syste 阅读全文
posted @ 2023-06-01 20:13 胖豆芽 阅读(10) 评论(0) 推荐(0) 编辑
摘要:package com.fqs.test; public class hello { public static void main(String[] args) { boolean flag=true;//立一个flag 开始走分支 真 代表能喝;假代表 不能喝 if(flag)//flag为真, 阅读全文
posted @ 2023-06-01 18:18 胖豆芽 阅读(12) 评论(0) 推荐(0) 编辑