Ainsteinx Logo
Ainsteinx
👤
Welcome to Ainsteinx
Login

Change Language

Currency

Home
Blog
Services
ທຸກບົດຮຽນ
EP.6 Python ສຳລັບຄົນ Laos

Dictionaries: look things up by name

words = {"ໝາ": "dog", "ແມວ": "cat", "ນົກ": "bird"}

print(words["ແມວ"])
words["ປາ"] = "fish"
print(len(words))
Video coming soon
EP.6 ຂໍ້ມູນ ແລະ ໂຄງສ້າງ

Dictionaries: look things up by name

Look up Lao → English translations with a dict.

dict ເກັບຂໍ້ມູນເປັນຄູ່ key: value ພາຍໃນວົງເລັບ { }. ເອີ້ນຄ່າດ້ວຍ key ແທນທີ່ຈະໃຊ້ຕຳແໜ່ງ.

ເໝາະກັບຂໍ້ມູນທີ່ມີຊື່ ເຊັ່ນ ລາຄາສິນຄ້າ ຫຼື ເບີໂທຂອງໝູ່.

ep06-dictionaries.py
words = {"ໝາ": "dog", "ແມວ": "cat", "ນົກ": "bird"}

print(words["ແມວ"])
words["ປາ"] = "fish"
print(len(words))

ຜົນລັບ

cat
4
  • #PythonສຳລັບຄົນLaos
  • #Python
  • #ຮຽນໂປຣແກຣມ
  • #ບອກຕໍ່ຄວາມຮູ້
  • #shorts