上一页 1 2 3 4 5 6 7 8 ··· 19 下一页
摘要: 所花时间:1小时 代码行:70行 博客量:1篇 了解到的知识点: import math # 定义平面点类 class Point: def _init_(self, x, y): self.x = x self.y = y # 重载小于运算符 def _lt_(self, other): dist 阅读全文
posted @ 2024-05-16 19:15 为20岁努力 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 所花时间:1小时 代码行:70行 博客量:1篇 了解到的知识点: # 自定义异常类 class Cexception(Exception): def _init_(self, message): self.message = message # 日期类 class Date: def _init_( 阅读全文
posted @ 2024-05-15 21:12 为20岁努力 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 所花时间:1小时 代码行:70行 博客量:1篇 了解到的知识点: # 教师接口 class Teacher: def calculate_salary(self): pass # 教授类 class Professor(Teacher): def _init_(self, name, gender, 阅读全文
posted @ 2024-05-14 21:43 为20岁努力 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 所花时间:1小时 代码行:70行 博客量:1篇 了解到的知识点: import math # 三维图形功能接口 class Shape3D: def get_perimeter(self): pass def get_area(self): pass def get_volume(self): pa 阅读全文
posted @ 2024-05-13 15:13 为20岁努力 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 所花时间:1小时 代码行:70行 博客量:1篇 了解到的知识点 # 定义人员类 People class People: def _init_(self, name, gender, age): self.name = name self.gender = gender self.age = age 阅读全文
posted @ 2024-05-12 21:14 为20岁努力 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 所花时间:1小时 代码行:70行 博客量:1篇 了解到的知识点:对比Python中的列表、元组、字典、集合、字符串等之间异同 列表(List) 特点: 可变(Mutable),即可以进行增删改操作。 使用方括号 [] 定义。 可以包含不同类型的元素。 有序,可以通过索引访问元素。 适用场景: 需要存 阅读全文
posted @ 2024-05-12 20:53 为20岁努力 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 所花时间:1小时 代码行:70行 博客量:1篇 了解到的知识点: def prime_factors(n): factors = [] # 存储质因子的列表 divisor = 2 # 从最小的质数2开始除 while n > 1: if n % divisor == 0: factors.appe 阅读全文
posted @ 2024-05-11 21:54 为20岁努力 阅读(26) 评论(0) 推荐(0) 编辑
摘要: 所花时间:1小时 代码行:70行 博客量:1篇 了解到的知识点: # 定义一个函数用于判断是否为素数 def is_prime(num): if num < 2: return False for i in range(2, int(num ** 0.5) + 1): if num % i == 0 阅读全文
posted @ 2024-05-10 21:17 为20岁努力 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 所花时间:1小时 代码行:70行 博客量:1篇 了解到的知识点: def count_ways(n): if n == 1: return 1 elif n == 2: return 2 elif n == 3: return 4 else: # 初始化台阶数为1、2、3的情况 a, b, c = 阅读全文
posted @ 2024-05-09 20:55 为20岁努力 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 所花时间:1小时 代码行:70行 博客量:1篇 了解到的知识点: def kaprekar(num): while num != 6174: digits = [int(x) for x in str(num)] digits.sort() asc_num = int(''.join(map(str 阅读全文
posted @ 2024-05-08 21:42 为20岁努力 阅读(57) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 19 下一页