# 06-class 专项练习

AI悦创原创Python 私教练习题【基础】Python 基础练习题大约 6 分钟...约 1883 字

## # 1. Person

``````# 测试
person = Person("Alice", 30)
person.introduce()
``````

## # 2. BankAccount

``````# 测试
account = BankAccount("123456", 1000, "John Doe")
account.deposit(500)
account.withdraw(200)
account.check_balance()
``````

## # 3. Circle

``````# 测试
circle = Circle(5)
print(circle.area())
print(circle.circumference())
``````

## # 4. Student

``````# 测试
student = Student("Bob", 20, {"Math": 85, "Physics": 90, "Chemistry": 78})
``````

## # 5. Car

``````# 测试
car = Car("Toyota", "Camry", 2015, 60000)
print(car.age())
car.drive(1000)
print(car.mileage)
``````

## # 6. Vector2D

``````# 测试
vector1 = Vector2D(2, 3)
vector2 = Vector2D(4, 1)
vector4 = vector1.subtract(vector2)
dot_product = vector1.dot_product(vector2)

print(f"vector3: ({vector3.x}, {vector3.y})")
print(f"vector4: ({vector4.x}, {vector4.y})")
print(f"dot_product: {dot_product}")
``````

AI悦创·编程一对一

AI悦创·推出辅导班啦，包括「Python 语言辅导班、C++ 辅导班、java 辅导班、算法/数据结构辅导班、少儿编程、pygame 游戏开发」，全部都是一对一教学：一对一辅导 + 一对一答疑 + 布置作业 + 项目实践等。当然，还有线下线上摄影课程、Photoshop、Premiere 一对一教学、QQ、微信在线，随时响应！微信：Jiabcdefh

C++ 信息奥赛题解，长期更新！长期招收一对一中小学信息奥赛集训，莆田、厦门地区有机会线下上门，其他地区线上。微信：Jiabcdefh

• 0
• 0
• 0
• 0
• 0

• 按正序
• 按倒序
• 按热度