Your first program: print()
print("ສະບາຍດີ ລາວ!")
print("ຂ້ອຍກຳລັງຮຽນ Python")
Your first program: print()
Write your first program in a single line!
print() ແມ່ນຄຳສັ່ງທີ່ໃຫ້ Python ສະແດງຂໍ້ຄວາມອອກໜ້າຈໍ. ຂໍ້ຄວາມທີ່ຢູ່ໃນເຄື່ອງໝາຍ " " ເອີ້ນວ່າ string.
Python ອ່ານໂຄດຈາກເທິງລົງລຸ່ມ ເທື່ອລະແຖວ, ສະນັ້ນ print 2 ແຖວ ກໍຈະໄດ້ຂໍ້ຄວາມ 2 ແຖວ.
print("ສະບາຍດີ ລາວ!")
print("ຂ້ອຍກຳລັງຮຽນ Python")
ຜົນລັບ
ສະບາຍດີ ລາວ! ຂ້ອຍກຳລັງຮຽນ Python
- #PythonສຳລັບຄົນLaos
- #Python
- #ຮຽນໂປຣແກຣມ
- #ບອກຕໍ່ຄວາມຮູ້
- #shorts
Watch and share on
ຮຽນຕໍ່
Variables: boxes for your data
name = "ສົມພອນ"
age = 20
height = 1.68
print(name, age, height)
Variables: boxes for your data
A variable is a labelled box that can hold anything.
if / else: let your program decide
age = 17
if age >= 18:
print("ລົງທະບຽນໄດ້")
else:
print("ຍັງນ້ອຍຢູ່")
if / else: let your program decide
How does a computer make decisions? With if.
for loops: repeat without retyping
for i in range(1, 6):
print("ຮອບທີ", i)
for loops: repeat without retyping
Count from 1 to 5 with a single line of logic.
Lists: many things in one place
cities = ["ວຽງຈັນ", "ຫຼວງພະບາງ", "ປາກເຊ"]
cities.append("ສະຫວັນນະເຂດ")
print(cities[0])
print(len(cities))
Lists: many things in one place
Can one variable hold many items? Yes, with a list.