Ainsteinx Logo
Ainsteinx
👤
Welcome to Ainsteinx
Login

Change Language

Currency

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

for loops: repeat without retyping

for i in range(1, 6):
    print("ຮອບທີ", i)
Video coming soon
EP.4 ພື້ນຖານ

for loops: repeat without retyping

Count from 1 to 5 with a single line of logic.

for ໃຊ້ເຮັດວຽກຊ້ຳຫຼາຍເທື່ອ. range(1, 6) ໃຫ້ຕົວເລກ 1, 2, 3, 4, 5 (ບໍ່ລວມ 6).

ແຕ່ລະຮອບ ຕົວແປ i ຈະປ່ຽນເປັນຕົວເລກຖັດໄປ.

ep04-for-loop.py
for i in range(1, 6):
    print("ຮອບທີ", i)

ຜົນລັບ

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