Skip to content

Instantly share code, notes, and snippets.

@KunYi
Created November 21, 2023 06:58
Show Gist options
  • Save KunYi/bccc4851e3b2c542b6c8ffbc472ccdbb to your computer and use it in GitHub Desktop.
Save KunYi/bccc4851e3b2c542b6c8ffbc472ccdbb to your computer and use it in GitHub Desktop.
Code Red: When Watermelons Win Over Tomatoes
#!/usr/bin/python
def 螢幕輸出(str):
print(str)
def 買西瓜(num):
return f"{num}個西瓜"
def 買蕃茄(num):
return f"{num}個蕃茄"
看到蕃茄 = True
'''
Code Red: When Watermelons Win Over Tomatoes
At breakfast,
the wife instructed the programmer,
'Get a watermelon on your way home,
and if you see tomatoes, grab two.'
After work, he bought two watermelons,
thinking he followed her instructions.
The wife, surprised, said,
'I meant tomatoes!'
The programmer chuckled,
'Well, you did say two if I saw tomatoes, right?
'''
西瓜 = 買西瓜(1)
if 看到蕃茄:
西瓜 = 買西瓜(2)
螢幕輸出(f"帶了{西瓜}回家")
西瓜 = 買西瓜(1)
# Wife means
if 看到蕃茄:
蕃茄 = 買蕃茄(2)
螢幕輸出(f"帶了{西瓜}和{蕃茄}回家")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment