ທຸກບົດຮຽນ
ep05-lists.py
EP.5
Python ສຳລັບຄົນ Laos
Lists: many things in one place
cities = ["ວຽງຈັນ", "ຫຼວງພະບາງ", "ປາກເຊ"]
cities.append("ສະຫວັນນະເຂດ")
print(cities[0])
print(len(cities))
Video coming soon
EP.5
ຂໍ້ມູນ ແລະ ໂຄງສ້າງ
Lists: many things in one place
Can one variable hold many items? Yes, with a list.
list ຂຽນດ້ວຍວົງເລັບ [ ]. ສະມາຊິກທຳອິດຢູ່ຕຳແໜ່ງ 0, ບໍ່ແມ່ນ 1.
ໃຊ້ .append() ເພີ່ມສະມາຊິກໃໝ່ ແລະ len() ນັບວ່າມີຈັກອັນ.
cities = ["ວຽງຈັນ", "ຫຼວງພະບາງ", "ປາກເຊ"]
cities.append("ສະຫວັນນະເຂດ")
print(cities[0])
print(len(cities))
ຜົນລັບ
ວຽງຈັນ 4
- #PythonສຳລັບຄົນLaos
- #Python
- #ຮຽນໂປຣແກຣມ
- #ບອກຕໍ່ຄວາມຮູ້
- #shorts
Watch and share on
ຮຽນຕໍ່
EP.6
Python ສຳລັບຄົນ Laos
Dictionaries: look things up by name
words = {"ໝາ": "dog", "ແມວ": "cat", "ນົກ": "bird"}
print(words["ແມວ"])
words["ປາ"] = "fish"
print(len(words))
EP.6
ຂໍ້ມູນ ແລະ ໂຄງສ້າງ
Dictionaries: look things up by name
Look up Lao → English translations with a dict.
EP.1
Python ສຳລັບຄົນ Laos
Your first program: print()
print("ສະບາຍດີ ລາວ!")
print("ຂ້ອຍກຳລັງຮຽນ Python")
EP.1
ພື້ນຖານ
Your first program: print()
Write your first program in a single line!
EP.2
Python ສຳລັບຄົນ Laos
Variables: boxes for your data
name = "ສົມພອນ"
age = 20
height = 1.68
print(name, age, height)
EP.2
ພື້ນຖານ
Variables: boxes for your data
A variable is a labelled box that can hold anything.
EP.3
Python ສຳລັບຄົນ Laos
if / else: let your program decide
age = 17
if age >= 18:
print("ລົງທະບຽນໄດ້")
else:
print("ຍັງນ້ອຍຢູ່")
EP.3
ພື້ນຖານ
if / else: let your program decide
How does a computer make decisions? With if.