Night 30: Show the world
Vous avez déjà terminé cette soirée, en Python ou en pseudocode. Elle compte pour les deux. Entraînez-vous à nouveau si vous le souhaitez.
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!
Difficulté 2/5 · 140 pièces + un petit bonus lors de la première réussite aujourd'hui
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.
Cliquez sur Exécuter pour voir le résultat ici.
Difficulté 2/5 · 140 pièces + un petit bonus lors de la première réussite aujourd'hui
Show what you learned. Use ", ".join(skills) to print I can use: print, loops, if, functions.
Cliquez sur Exécuter pour voir le résultat ici.
Difficulté 2/5 · 140 pièces + un petit bonus lors de la première réussite aujourd'hui
Define certificate(name). It returns Kit finished 30 Code Nights! for Kit. Print it for your pet.
Cliquez sur Exécuter pour voir le résultat ici.
Difficulté 3/5 · 200 pièces + un petit bonus lors de la première réussite aujourd'hui
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 *.
Cliquez sur Exécuter pour voir le résultat ici.