๐Ÿงช ็ปงๆ‰ฟไธŽๅคšๆ€

โฑ๏ธ 25-30 min๐Ÿ“Š Intermediate
main.py
Costs 1 credit
ๅŠ ่ฝฝ็ผ–่พ‘ๅ™จไธญ...
่พ“ๅ‡บ Outputๆ‰ง่กŒๆˆๅŠŸ
# ่ฟ่กŒไปฃ็ ๅŽ๏ผŒ่พ“ๅ‡บๅฐ†ๆ˜พ็คบๅœจ่ฟ™้‡Œ
# ๆŒ‰ Ctrl+Enter ๅฟซ้€Ÿ่ฟ่กŒ
Terminal (Simulated)Install commands are simulated only, no real network requests
$

Step 1: ๅŸบๆœฌ็ปงๆ‰ฟ

็ปงๆ‰ฟ่ฎฉๅญ็ฑป็›ดๆŽฅๆ‹ฅๆœ‰็ˆถ็ฑป่ƒฝๅŠ›๏ผŒๅ‡ๅฐ‘้‡ๅคๅฎšไน‰ๅฑžๆ€งๅ’ŒๅŸบ็ก€ๆ–นๆณ•ใ€‚

ๅบ•ๅฑ‚้€ป่พ‘๏ผš
class Dog(Animal) ไผšๅปบ็ซ‹็ฑปๅž‹ๅฑ‚็บง๏ผŒDog ๅฎžไพ‹ๅœจๆ‰พไธๅˆฐๆˆๅ‘˜ๆ—ถไผšๅ‘ Animal ๆŸฅๆ‰พใ€‚
ๅ› ๆญคๅญ็ฑปๅ“ชๆ€•ไธๅ†™ speak๏ผŒไนŸ่ƒฝ่ฐƒ็”จ็ˆถ็ฑป็‰ˆๆœฌใ€‚

ไฝ ็š„ไปปๅŠก๏ผš

  1. ๅˆ›ๅปบ็ˆถ็ฑป Animal๏ผŒๆœ‰ name ๅฑžๆ€งๅ’Œ speak() ๆ–นๆณ•๏ผˆ่พ“ๅ‡บ "..."๏ผ‰
  2. ๅˆ›ๅปบๅญ็ฑป Dog(Animal)๏ผŒ็ปงๆ‰ฟ Animal
  3. ๅˆ›ๅปบ Dog ๅฎžไพ‹ๅนถ่ฐƒ็”จ speak()

Self-Check List

  • ๅˆ›ๅปบๅŸบๆœฌ็š„็ปงๆ‰ฟๅ…ณ็ณป

Transfer Template

class Animal:
    def __init__(self, name):
After completing this step, you should be able to independently explain and reproduce this concept, then apply it to similar problems.

้ชŒ่ฏๆธ…ๅ• (0/0)