The last letter · ตัวอักษรตัวสุดท้าย
The last letter
word is "python". Store its last character in last, without counting the letters yourself.
A negative position counts from the end: word[-1] is the last character, word[-2] the one before it. It works whatever the length.
ตัวอักษรสุดท้าย
word คือ "python". เก็บ ตัวอักษรสุดท้าย ลงใน last, โดยไม่ต้องนับตัวอักษรเอง
ตำแหน่งลบนับจากท้าย: word[-1] คือตัวอักษรสุดท้าย, word[-2] คือตัวก่อนหน้า. มันใช้ได้ไม่ว่าความยาวเท่าใด
word is "python". Store its last character in last, without counting the letters yourself. · word คือ "python". เก็บ ตัวอักษรสุดท้าย ลงใน last, โดยไม่ต้องนับตัวอักษรเอง
Click Run to see the output here. · คลิก Run เพื่อดูผลลัพธ์ที่นี่