搜尋此網誌

2026年3月3日星期二

一字之差

巴基斯坦

  • Pakistan
  • country in southern Asia bordering the Arabian Sea; originally comprising two parts—West Pakistan (now Pakistan) and East Pakistan (now Bangladesh)—separated by about 1000 miles (1600 kilometers) of northern India; a dominion 1947–56, an Islamic republic since 1956, and a member of the Commonwealth of Nations 1956–72; formed from parts of former British India; capital Islamabad area 307,374 square miles (796,095 square kilometers), population 207,863,000
  • www.merriam-webster.com/dictionary
  • 巴勒斯坦
  • Palestine
  • Palestine, region of Southwest Asia along the eastern Mediterranean, generally regarded as consisting of the southern coastal area between Egypt, where Asia meets Africa, and Tyre, which in ancient times was the most prominent of the Phoenician city-states.
  • www.britannica.com/place

functions in python

parenthesis: IPA[pəˈrenθəsɪs]

parentheses /pəˈrenθəsiːz/

Common Uses of Shift + Enter

- Jupyter Notebook / JupyterLab

- Runs the current cell and moves to the next one.

- Equivalent to executing code in that cell.

- VS Code (with Python extension)

- By default, it can send selected code to the terminal or Python Interactive window.

- Sometimes it runs code in the terminal instead of the interactive window, depending on your settings.

- You can customize this in Keyboard Shortcuts by mapping Shift + Enter to Python: Run Selection/Line in Python Interactive Window.

In Python, the keyword def is used to define a function. Functions are reusable blocks of code that perform a specific task when called

In Python, the return statement is used inside a function to send a value back to the caller. It’s one of the most important ways to control the flow of data in your program.

Examples
Returning a value:
def square(n):
    return n * n

result = square(4)
print(result)  # Output: 16

append something (to something) to add something to the end of a piece of writing

def greet(name):
    print("Hello,", name)

x = greet("Samson")
print(x)  # Output: None

- Use return when you want your function to produce a value that can be used later.
- Skip return when your function’s job is just to perform an action (like printing or updating a file)

- With return → function is like a vending machine (you get something back).
- Without return → function is like a loudspeaker (it just outputs sound, but you don’t get a reusable object).

Mainly from Microsoft Copilot