- 博客(11)
- 资源 (1)
- 收藏
- 关注
原创 数据结构----稀疏数组
public class qipan { public static void main(String[] args) { //创建一个二维数组 //0没有棋子,1表示黑子,2表示蓝色 int chessArr1[][] = new int[11][11]; chessArr1[1][2] = 1; chessArr1[2][3] = 2; //输出原始的二维数组 System.ou.
2022-04-22 21:37:20
322
原创 Python--for循环最终版
//小星星的输出# 定义一个变量# i = 1# while i <= 5:# print("*" * i)# i += 1row = 1while row <= 5: # 增加一个小的循环,专门负责当前行中每一列的星星显示 col = 1 while col <= row: print("*", end="") col += 1 # 能过使星星输出以后换行 print("") .
2021-11-20 22:17:28
429
原创 Python--for循环进阶版
# 0~100之间的时间求和# 定义最终结果result = 0# 定义一个变量i = 0# 循环while i <= 100: print(i) # 每次循环,都让result这个变量和i相加 result += i i += 1print("0~100之间的数字求和结果 = %d" % result)//偶数求和# 定义俩个变量result = 0i = 0while i <= 100: # 判断变量 i 中的数值,是.
2021-11-20 22:15:33
883
原创 Python基础--for循环
age = int(input("请输入年龄:"))if age >= 18: print("成年人,欢迎进网吧嗨皮")else: print("回家写作业")python_score = int(input("请输入成绩"))c_score = int(input("请输入成绩"))if python_score >60 or c_score > 60: print("考试通过")else: print("考试失败,继续努力".
2021-11-20 22:07:32
720
原创 Python基础——格式化输出
# 小明name = "小明"print("我的名字叫 %s,请多多关照" % name)# 学号student_no = 456print("我的学号是 %06d" % student_no)# 定义小数price = 8.5weight = 7.5money = price * weightprint("苹果单价 %.02f 元/斤,购买了 %.02f 斤,需要支付 %.02f 元" % (price, weight, money))# 小数 scalescal.
2021-11-20 21:58:19
527
原创 python基础
# 小明name = "小明"print("我的名字叫 %s,请多多关照" % name)# 学号student_no = 456print("我的学号是 %06d" % student_no)# 定义小数price = 8.5weight = 7.5money = price * weightprint("苹果单价 %.02f 元/斤,购买了 %.02f 斤,需要支付 %.02f 元" % (price, weight, money))# 小数 scale.
2021-11-15 21:47:18
525
原创 python基础
# 提示苹果单价price = float(input("苹果单价:"))# 苹果重量weight = float(input("苹果重量:"))money = price * weightprint(money)在原先的基础上进行优化,并且在减少了代码数量的同时使得代码更简单...
2021-11-15 21:42:15
385
原创 python基础
# 输入苹果单价price_str = input("苹果的单价:")# 输入苹果的重量weight_str = input("苹果的重量:")# 转换price = float(price_str)weight = float(weight_str)# 总金额money = price * weightprint(money)第一次敲Python的代码,实现了用户输入可以进行操作。...
2021-11-15 21:39:14
235
原创 数组代码的IDEA手敲
public class Demon02 { public static void main(String[] args) { /*String a="hello"; int num=20; System.out.println(a); System.out.println(num);*/ int mum1 =10; //常用 byte num2=20; short mum4=...
2021-10-26 17:54:24
85
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人