020第11章 TESTING YOUR CODE_續2_optional

wenwen
·
·
IPFS
·
再一次接觸 optional

💛20230120晨讀感言:

💔連續幾日的練習,對於 markdown 語法下,安插 Code區塊 並讓 `^` block 可以正常的連結, 已達到熟練的地步。不過為了安全起見,我還是會在 安插 完成後,做一個簡單的測試。

💔對於 function 裡 的 str parameter,給予一個 空字串,再搭配 if 句型,就很容易 完成一個 具有optional 的 參數 (如下圖)。

optional 範例


💛晨讀摘要:

💚213 Responding to a Failed Test:What do you do when a test fails? Assuming you’re checking the right con- ditions, a passing test means the function is behaving correctly and a fail- ing test means there’s an error in the new code you wrote. So when a test fails, don’t change the test. Instead, fix the code that caused the test to fail. Examine the changes you just made to the function, and figure out how those changes broke the desired behavior.

from :《python crash course》











CC BY-NC-ND 2.0

Like my work? Don't forget to support and clap, let me know that you are with me on the road of creation. Keep this enthusiasm together!

wenwen探索網路世界和進入區塊鏈的過程或許很平凡,但我就是想分享給大家,若能幫助到有需要幫助的人,那就更好了。 有幫到你的話,記得按下方拍手圖,不需花你任何金錢,免費註冊Liker ID,就可對我化讚為賞:https://button.like.co/willie5068
  • Author
  • More

033第12章 A SHIP THAT FIRES BULLETS_續10_pygame.sprite.Group class

032第12章 A SHIP THAT FIRES BULLETS_續9_pygame.Rect() class

031第12章 A SHIP THAT FIRES BULLETS_續8_super().init()