上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 41 下一页
摘要: class CuteCat: def __init__(self, cat_name, cat_age, _cat_color): self.name = cat_name self.age = cat_age self.color = _cat_colorcat1 = CuteCat("Jojo" 阅读全文
posted @ 2025-10-31 16:13 偷懒的阿贤 阅读(3) 评论(0) 推荐(0)
摘要: class Student: def __init__(self, study_name: int, school_name: str): self.name = study_name self.school_name = school_name def go_school(self, school 阅读全文
posted @ 2025-10-31 11:54 偷懒的阿贤 阅读(1) 评论(0) 推荐(0)
摘要: 一、项目结构与命名​ my_utils/├── src/│ └── my_utils/ # 真正的包目录(Python 3.3+ 可省略 __init__.py,但建议保留)│ ├── __init__.py│ └── calculator.py├── tests/│ └── test_calcul 阅读全文
posted @ 2025-10-31 11:53 偷懒的阿贤 阅读(8) 评论(0) 推荐(0)
摘要: #使用import引入模块import statisticsprint("\n" + str(statistics.median([1,2,3,4,5,6,7,8,9])))#使用from xx import xx 直接引入模块中的函数from statistics import meanprint 阅读全文
posted @ 2025-10-31 11:46 偷懒的阿贤 阅读(2) 评论(0) 推荐(0)
摘要: def calculate_BMI(weight, height): BMI = weight / (height * height) if BMI < 18.5: category = "偏瘦" elif BMI < 25: category = "正常" elif BMI < 30: categ 阅读全文
posted @ 2025-10-31 11:29 偷懒的阿贤 阅读(1) 评论(0) 推荐(0)
摘要: def calculate_sector(central_angle, radius): #接下来是一些定义函数的代码 sector_area = central_angle / 360 * 3.14 * radius ** 2 print("Sector area: ", sector_area) 阅读全文
posted @ 2025-10-31 11:17 偷懒的阿贤 阅读(2) 评论(0) 推荐(0)
摘要: 1 阅读全文
posted @ 2025-10-31 10:33 偷懒的阿贤 阅读(5) 评论(0) 推荐(0)
摘要: 1 阅读全文
posted @ 2025-10-31 10:32 偷懒的阿贤 阅读(4) 评论(0) 推荐(0)
摘要: 1 阅读全文
posted @ 2025-10-31 10:32 偷懒的阿贤 阅读(2) 评论(0) 推荐(0)
摘要: gpa_dict = {}#字典增加key:valuegpa_dict.setdefault("A", 10.2)gpa_dict.setdefault("B", 30.315)gpa_dict.setdefault("C", 20.45)gpa_dict.setdefault("D", 40.65 阅读全文
posted @ 2025-10-31 10:31 偷懒的阿贤 阅读(5) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 41 下一页