Night 30: Show the world
Bạn đã hoàn thành đêm này bằng Python hoặc mã giả. Kết quả được tính cho cả hai. Bạn có thể luyện tập lại nếu muốn.
Tonight: show the world
- This is night 30! Finish it, and your pet becomes a star.
- Tonight you make a card to show what you and your pet can do.
Words for tonight
| Word | Meaning |
|---|---|
| share | show something to other people |
| card | a small, nice page with some facts |
| proud | happy about something good that you did |
Look how far you came
| Week | You learned |
|---|---|
| 1 | print, variables, input(), numbers, if, lists, for |
| 2 | while, random, functions, parameters, return |
| 3 | text tools, f-strings, dictionaries, sum, min, max |
| 4 | nested loops, 2D lists, a game loop, try, clean code |
| 5 | your own pet game |
One more tool: join
", ".join(items)puts,between the items of a list.
toys = ["ball", "kite", "box"]
print("Toys: " + ", ".join(toys))
print(" - ".join(toys))
A frame that fits
- The size of the frame comes from
len(name), so it fits every name.
name = "Lumi"
border = "*" * (len(name) + 4)
print(border)
print("* " + name + " *")
print(border)
What next?
- Go back to your hub: your pet's card is ready to save and share.
- Want more? The full Python Basics course goes deeper into every idea.
- Keep coding a little every day. Ten minutes a night is how you learned all this!
Độ khó 2/5 · 140 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
Make your pet's star card. Read a name and a kind. Print 4 lines: *** 30 Code Nights ***, Name: Kit, Kind: fox, Nights: 30/30.
Nhấn Chạy để xem kết quả ở đây.
Độ khó 2/5 · 140 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
Show what you learned. Use ", ".join(skills) to print I can use: print, loops, if, functions.
Nhấn Chạy để xem kết quả ở đây.
Độ khó 2/5 · 140 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
Define certificate(name). It returns Kit finished 30 Code Nights! for Kit. Print it for your pet.
Nhấn Chạy để xem kết quả ở đây.
Độ khó 3/5 · 200 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
Put a name in a frame of stars. Read a name. The top and bottom lines have len(name) + 4 stars. The middle line is * Kit *.
Nhấn Chạy để xem kết quả ở đây.