mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-01 11:29:51 +08:00
* docs: add Japanese documents (`ja/docs`) * docs: add Japanese documents (`ja/codes`) * docs: add Japanese documents * Remove pythontutor blocks in ja/ * Add an empty at the end of each markdown file. * Add the missing figures (use the English version temporarily). * Add index.md for Japanese version. * Add index.html for Japanese version. * Add missing index.assets * Fix backtracking_algorithm.md for Japanese version. * Add avatar_eltociear.jpg. Fix image links on the Japanese landing page. * Add the Japanese banner. --------- Co-authored-by: krahets <krahets@163.com>
37 lines
926 B
Python
37 lines
926 B
Python
"""
|
|
File: built_in_hash.py
|
|
Created Time: 2023-06-15
|
|
Author: krahets (krahets@163.com)
|
|
"""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
sys.path.append(str(Path(__file__).parent.parent))
|
|
from modules import ListNode
|
|
|
|
"""Driver Code"""
|
|
if __name__ == "__main__":
|
|
num = 3
|
|
hash_num = hash(num)
|
|
print(f"整数 {num} のハッシュ値は {hash_num}")
|
|
|
|
bol = True
|
|
hash_bol = hash(bol)
|
|
print(f"ブール値 {bol} のハッシュ値は {hash_bol}")
|
|
|
|
dec = 3.14159
|
|
hash_dec = hash(dec)
|
|
print(f"小数 {dec} のハッシュ値は {hash_dec}")
|
|
|
|
str = "Hello algorithm"
|
|
hash_str = hash(str)
|
|
print(f"文字列 {str} のハッシュ値は {hash_str}")
|
|
|
|
tup = (12836, "Ha")
|
|
hash_tup = hash(tup)
|
|
print(f"タプル {tup} のハッシュ値は {hash(hash_tup)}")
|
|
|
|
obj = ListNode(0)
|
|
hash_obj = hash(obj)
|
|
print(f"ノードオブジェクト {obj} のハッシュ値は {hash_obj}") |