mirror of
https://github.com/krahets/hello-algo.git
synced 2026-11-08 20:49:50 +08:00
Retranslate the complete Japanese online edition from Chinese (#2008)
* Retranslate the complete Japanese online edition from Chinese * Fit Japanese homepage labels and localize heading permalinks * Point Japanese contribution instructions to the Japanese preview * Replace locale conditionals with multilingual UI tables
This commit is contained in:
@@ -4,13 +4,13 @@ Created Time: 2022-11-29
|
||||
Author: Peng Chen (pengchzn@gmail.com)
|
||||
"""
|
||||
|
||||
"""Driver Code"""
|
||||
"""実行用コード"""
|
||||
if __name__ == "__main__":
|
||||
# スタックを初期化する
|
||||
# Python には組み込みのスタッククラスがないため、list をスタックとして使える
|
||||
stack: list[int] = []
|
||||
|
||||
# 要素をプッシュ
|
||||
# 要素をプッシュする
|
||||
stack.append(1)
|
||||
stack.append(3)
|
||||
stack.append(2)
|
||||
@@ -18,19 +18,19 @@ if __name__ == "__main__":
|
||||
stack.append(4)
|
||||
print("スタック stack =", stack)
|
||||
|
||||
# スタックトップの要素にアクセス
|
||||
# スタックの先頭要素にアクセスする
|
||||
peek: int = stack[-1]
|
||||
print("スタックトップ要素 peek =", peek)
|
||||
print("スタックの先頭要素 peek =", peek)
|
||||
|
||||
# 要素をポップ
|
||||
# 要素をポップする
|
||||
pop: int = stack.pop()
|
||||
print("ポップした要素 pop =", pop)
|
||||
print("ポップ後 stack =", stack)
|
||||
|
||||
# スタックの長さを取得
|
||||
# スタックの長さを取得する
|
||||
size: int = len(stack)
|
||||
print("スタックの長さ size =", size)
|
||||
|
||||
# 空かどうかを判定
|
||||
# 空かどうかを判定する
|
||||
is_empty: bool = len(stack) == 0
|
||||
print("スタックが空かどうか =", is_empty)
|
||||
print("スタックは空か =", is_empty)
|
||||
|
||||
Reference in New Issue
Block a user